mrlooi / rotated_maskrcnn

Rotated Mask R-CNN: From Bounding Boxes to Rotated Bounding Boxes
MIT License
347 stars 62 forks source link

Overlapping masks #2

Closed elepherai closed 4 years ago

elepherai commented 4 years ago

Hi, thanks for your great work.

Recently I have been trying to train my own dataset with rotated_maskrcnn.

I found that there are some overlapping masks in the results. The scores are high enough, so I cannot filter them by threshold.

Do you have any suggestions about the overlapping problem? Thank you.

mrlooi commented 4 years ago

Option 1) Lower NMS threshold Try reducing the NMS thresh score in the config (yaml file). It's 0.5 by default, 0.3 would be a pretty good threshold. See MODEL.ROI_HEADS.NMS in config/defaults.py

However, it's possible to still have overlapping masks, especially when 2 rotated boxes have low box overlap, but high mask overlap. This can also happen with regular bounding box detections, but it's a lot less common. Option 2) Filter by Mask IoU Compare the mask IoU between 2 detections. If IoU > 0.8 (or some high threshold), discard the detection with the lower score

elepherai commented 4 years ago

Thanks mrlooi, I have used option 2 and it worked fine. As for option 1, should I retrain the model? Or just need to change the NMS threshold in inference?

mrlooi commented 4 years ago

Just change the NMS threshold. The MODEL.ROI_HEADS.NMS is used during inference.

In the config .yaml, add 'NMS' under 'ROI_HEADS' Screenshot from 2019-09-25 10-37-50

elepherai commented 4 years ago

It seems better after changing NMS to 0.3, but still have some overlaps. I decide to combine two methods to reduce overlaps.

Thanks mrlooi. Have a great day!

Baby47 commented 4 years ago

Since you have successfully run this project, i wonder if the rotated results are normal in your dataset, i have trained a model but found the predicted angle is too small so that the predicted bounding boxes are almost horizontal. I wonder your help. @elepherai @mrlooi

Thanks very much!

mrlooi commented 4 years ago

Do you have example images of the predictions? It's possible that horizontal bounding boxes could be the best fit for the object too

Baby47 commented 4 years ago

I have. Sorry, i cannot make full sense of your idea. Would you like to leave your contact information? @mrlooi

elepherai commented 4 years ago

@Baby47 Hi, the roteated results are normal, and the angles also make sense in my dataset.

mrlooi commented 4 years ago

@Baby47 can you post an example of the predicted results?

Baby47 commented 4 years ago

It’s not convenient to post here . The angle is about 1 or 2 really small number. @mrlooi

mrlooi commented 4 years ago

What I meant was you can post a picture of the predictions generated using the infer_demo.py file

Baby47 commented 4 years ago

Can you leave your email address? @elepherial

elepherai commented 4 years ago

@Baby47 elepher.ai AT gmail.com