Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"To check that no frame contains overlapping masks" : Can we use mots_tools for overlapping masks? #14

Open
PanaddaK opened this issue Mar 1, 2022 · 2 comments

Comments

@PanaddaK
Copy link

PanaddaK commented Mar 1, 2022

Hi, following your code I found that

  1. In mots_common.io => load_txt(path)
    You have to check that no frame contains overlapping masks...

    if frame not in combined_mask_per_frame:
    combined_mask_per_frame[frame] = mask
    elif rletools.area(rletools.merge([combined_mask_per_frame[frame], mask], intersect=True)) > 0.0:
    assert False, "Objects with overlapping masks in frame " + fields[0]
    else:
    combined_mask_per_frame[frame] = rletools.merge([combined_mask_per_frame[frame], mask], intersect=False)
    objects_per_frame[frame].append(SegmentedObject(
    mask,
    class_id,
    int(fields[1])

  2. Is it possible to use mots_tools with overlapping masks/objects? How?

  3. I've tried to run mots_tools with my data that contain over masks by removing the conditions checking for overlapping masks. The tools can run without any error. I'm not sure whether the result was correct or not.

Please give me some advice on this. Thank you.

@pvoigtlaender
Copy link
Collaborator

Hi,

what you can do is to just disable the assertion, seems you already did that.
This should mostly be ok, but if masks overlap a lot then the mapping which will be established can be incorrect. For practical purposes it should probably in most cases be ok.
What you can also do is to enforce your masks to be non-overlapping by arbitrarily assigning overlapping pixels to only one mask (I would recommend to assign them to the smaller mask which proved to be a reasonable heuristic).

@PanaddaK
Copy link
Author

Hi,

what you can do is to just disable the assertion, seems you already did that. This should mostly be ok, but if masks overlap a lot then the mapping which will be established can be incorrect. For practical purposes it should probably in most cases be ok. What you can also do is to enforce your masks to be non-overlapping by arbitrarily assigning overlapping pixels to only one mask (I would recommend to assign them to the smaller mask which proved to be a reasonable heuristic).

Thank you so much for your kind support and suggestion. ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants