Closed mohdsaqibxa closed 11 months ago
Hi,
If you want to fine-tune SAM with multiple bounding boxes, you need to create several training examples, each containing a single (image, box, mask) triplet.
Will close this issue as it's resolved, feel free to reopen.
@NielsRogge you mentioned we have to create triplets like (image, box, mask)
, So lets say I have 20 bounding boxes in an image. So the triplets will be
option 1:
(image, box1, mask)
(image, box2, mask)
...
Or option2:
(image, box1, mask1)
(image, box2, mask2)
...
option 2 makes sense but it is not clear to me how we would extract mask1
, mask2
etc corresponding to the box from the given ground truth mask
@nahidalam Do you know which way to use?
(image, box1, mask) (image, box2, mask)
I've tried both of these methods and I've found that using all masks works better because the other way suppresses the generation of other masks of the same kind.
But the effect is also mediocre.This is the effect of training 4 rounds:
Hey @sijie-Xu, I am also working on a project where I have to use multiple bounding boxes for the prompt to increase the segmentation for multiple objects in an image. Can I know how you created the triplets and can you publish the code? It will be really helpful. Thanks a lot @sijie-Xu in advance
you just created like it
嘿,我也在做一个项目,我必须使用多个边界框作为提示,以增加图像中多个对象的分割。我能知道你是如何创建三元组的,你能发布代码吗?这将非常有帮助。提前非常感谢
@sijie-Xu can you please explain your approach in detail
@NielsRogge I tried to fine tune SAM on a custom dataset using your notebook but with multiple bounding boxes instead of one bounding box.
https://github.com/NielsRogge/Transformers-Tutorials/blob/master/SAM/Fine_tune_SAM_(segment_anything)_on_a_custom_dataset.ipynb
Right now, I think this notebook is fine-tuning the SAM with only one bounding box prompt. While I tried to do it with multiple bounding boxes it gives me an error:
Dimensions for one single image:
Dimensions for a batch of 2:
Here, I am using 3 bounding boxes for each image.
Please help me with this. How can I fine tune with multiple bounding boxes? Also, please let me know if I am missing something here. Thanks in advance.