bnsreenu / python_for_microscopists

https://www.youtube.com/channel/UC34rW-HtPJulxr5wp2Xa04w?sub_confirmation=1
MIT License
3.91k stars 2.39k forks source link

Overlapping instances in fine-tuning SAM #82

Open Ashutosh1995 opened 6 months ago

Ashutosh1995 commented 6 months ago

Hello @bnsreenu

Thanks for providing the repo for fine-tuning the SAM model on the custom dataset. My question is that in case where the instances of the object are overlapping then in that case, how can I change the code to include different boxes for different objects?

Kindly provide your suggestion? temp_binary

RoyAn2386 commented 6 months ago

Hi man,

I think you should prepare your label as instance mask (random color for each object), then use finding contour to get different boxes. T.T

Ashutosh1995 commented 6 months ago

Thanks for your reply! You mean to say in this mask, assign each object with different color as in different ID, apply patchify. In that 256x256 instance, see for which instance is coming and get boxes using contours?

Also I saw in the notebook that you were using ViT-B, doesn't that internally resizes the image to be 1024x1024? If that's the case, what GPU are you using to finetune this model?