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
.
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?
question from:
https://stackoverflow.com/questions/65889645/label-bounding-box-for-patches-sharing-the-same-predicted-feature 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…