Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

python - Label bounding box for patches sharing the same predicted feature

I ran a patch-based convolutional neural network and I want to ‘morph’ neighbouring patches with the same predicted class into larger patch. In the example table below farmland has the highest probability among all other classes. I want to create a bounding box that wraps all of these 6 patches and label the box with farmland.

enter image description here

I used opencv cv2.boundingRect() to draw boundary boxes on my masked image. I have created a list of bounding_boxes and coordinates -- How do I add the predicted class i.e. the one showing highest probability to each box?

contours, hierarchy = cv2.findContours(edged.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
bounding_boxes = [cv2.boundingRect(contour) for contour in contours]

In addition, the predicted classes are scattering all over in my mask image, like in the image below. Each colour indicates a class label. As I draw bounding_boxes some of the areas may include other labels. What might be the 'better' ways to create these boxes so that each of them contains a single predicted class?

enter image description here

question from:https://stackoverflow.com/questions/65889645/label-bounding-box-for-patches-sharing-the-same-predicted-feature

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...