i wonder if there is already an implementation or an util to extract boundingboxes from the segmentation masks produced by deeplab's model?
I wanted to investigate the seg_maps that are the ouput of the tf session when running deeplabv3_mnv2 (https://github.com/GustavZ/realtime_segmenation), but printing the map results in a kind of reduced/simplified array in the form of
[[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
...
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]
[0 0 0 ... 0 0 0]]
So i can't really figure out how to extract bounding boxes from this. But in my understanding it should be possible to create a box around each connected object segment in the mask, right?
Has anybody experience with it, or give me a hint on how to proceed?
Unfortunately, I am not aware of any util for that. However, any contribution is welcome.
did it
Hi @GustavZ did you manage to get bounding boxes working? if so how did you manage it.
Cheers
@crazyfrog-github yes
@aquariusjay would this be interesting as pull request?
Sure, it will be great to have it.
Thanks a lot for looking into this!
ALright.
One more thing: deeplab is not capable of doing instance segmentation, right?
No, since the model only performs semantic segmentation right now.
@GustavZ @aquariusjay I'm doing this for my task:
bboxes = {}
for i in range(num_labels):`
rows, cols = np.where(seg_masks == i)
tl_x, tl_y = np.min(cols), np.min(rows)
br_x, br_y = np.max(cols), np.max(rows)
bboxes[i] = [tl_x, tl_y, br_x, br_y]
@alasin this is not solving the issue for multiple objects of the same class in one image/frame.
I implemented a labeling algorithm using scikit-image. It works perfectly well as you can see on my project https://github.com/GustavZ/realtime_segmenation (have a look at the small demo-gif where there are two chairs correctly detected/segmented)
Hi There,
We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing.
If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.
Most helpful comment
@alasin this is not solving the issue for multiple objects of the same class in one image/frame.
I implemented a labeling algorithm using scikit-image. It works perfectly well as you can see on my project https://github.com/GustavZ/realtime_segmenation (have a look at the small demo-gif where there are two chairs correctly detected/segmented)