-
Notifications
You must be signed in to change notification settings - Fork 135
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
Convert class and instance binary masks to COCO instances format #858
Comments
Hi @maritum, Thanks for your interests on our project! Sorry for inconvenience but there is no high-level API for this functionality. Instead, I created a simple Jupyter-notebook example to solve your problem using Datumaro. Please refer to this: https://github.com/vinnamkim/datumaro/blob/cs/make-coco-instance-mask/notebooks/08_assign_label.ipynb p.s. The visualization part of the notebook will be working after #860 is merged. |
Hi @vinnamkim! Thank you again for your help. It works great! I am curious if you have any recommendations for memory optimization when using Thank you in advance! |
Hi @maritum, Sorry, I don't get your point about memory optimization. Could you give me more details? I guess if you built your dataset with import numpy as np
import pycocotools.mask as mask_utils
import datumaro as dm
binary_mask = np.array(
[
[1, 1, 1],
[1, 1, 0],
[1, 0, 0],
], dtype=np.uint8, requirements="F"
)
rle_binary_mask = mask_tools.encode(binary_mask)
# You can use dm.RleMask as the compressed version of dm.Mask
mask = dm.RleMask(
id=0,
group=0,
image=rle_binary_mask,
label=0
) This example shows how to use |
Because there has been no response for long time, I'll close this ticket. |
Hi everyone!
I am wondering if there is a way to convert dataset to
coco-instances
format by using class and instance masks.common_semantic_segmentation
format accepts only single mask, so this makes difficult to distinguish instances from the same class on the image. Is there a way to provide an instance mask with the dictionary{instance_id :class_id}
or two binary masks for dataset conversion?Thank you!
The text was updated successfully, but these errors were encountered: