-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add ExtractedMask and update importers who can use it to use it #1480
Add ExtractedMask and update importers who can use it to use it #1480
Conversation
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1480 +/- ##
===========================================
- Coverage 80.85% 80.84% -0.02%
===========================================
Files 271 273 +2
Lines 30689 31402 +713
Branches 6197 6316 +119
===========================================
+ Hits 24815 25386 +571
- Misses 4489 4592 +103
- Partials 1385 1424 +39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
>>> | ||
>>> index_mask = np.random.randint(low=1, high=3, size=(10, 10), dtype=np.uint8) | ||
>>> mask1 = ExtractedMask(index_mask=index_mask, index=1, label=1) # | ||
>>> mask2 = ExtractedMask(index_mask=index_mask, index=2, label=2) # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between index
and label
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As described here
datumaro/src/datumaro/components/annotation.py
Lines 513 to 515 in e2e945e
Attributes: | |
index_mask: Integer 2D Numpy array. Its pixel can indicate a label id (class) or an instance id. | |
index: Integer value to extract a binary mask from the given index mask. |
index
can denote an instance id or a label id. It depends on the dataset. Anyway, I enhanced the example docstring in af03f29 to make it more descriptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still confused. The updated example have the same index and label. In my understanding, mask1 is a binary mask with 0 and 1, where all 1s indicate the index
indeed. This looks fine. But index
might be label
for all cases. Is there any case that index
is not equal to label
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mask
is a binary mask and its 1s actually indicate label=1
(not index=1
) in this example. index
is just used to extract a binary mask from index_mask
. It is possible that index
can be different with label
by dataset transformation. For example, if the label remapping transform merges label=1, index=1
(1: apple) and label=2, index=2
(2: orange) to label=3
(3: fruits). Then, apple masks will have index=1, label=3
and orange masks will have index=2, label=3
.
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
Summary
ExtractedMask
which is a dedicated mask annotation class to use a single index mask source. The index mask is a integer 2D array and its pixel can indicate a label id (class) or instance id.ExtractedMask
and it share the same index mask, 2) Just extract the source index maskIt can save huge computations required for 2D array manipulations: creating a binary mask and merging binary masks.
How to test
Checklist
License
Feel free to contact the maintainers if that's a concern.