-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 mask binary image to polygon format #131
Comments
You can try this. I haven't tested it to actually work as a valid COCO format though. Let me know if it works for you.
produces the following output:
|
@waspinator I modified your code to read a file path of mask binary images, and it worked for me. Thank you very much! |
@waspinator I was wondering why you would use |
@JerryLingjieMei I think it was just because [x, y] coordinates were in the wrong order. I've since worked on packaging up a tool to create coco json files. Take a look at https://github.com/waspinator/pycococreator/ |
First of all, thank you @waspinator for all the tools that you've created for us to use. You've saved me so much time along the way. "segmentation": {"size": [512, 512], "counts": "UjU5g2W=6L1O01N3TOdVg2"}, "bbox": [331.0, 321.0, 7.0, 97.0]}, {"image_id": "1Z514B22DA1B2XYZ.jpg", "category_id": 1, "score": 0.9703407883644104, "segmentation": {"size": [512, 512], "counts": "dgU5l1P=U1N1001Nh0cM_Zg2"}, "bbox": [331.0, 207.0, 6.0, 102.0]}, {"image_id": "1Z412D6B6A1B2XYZ.jpg", "category_id": 2, "score": 0.9999915361404419, that's part of the output of the code in the predictions notebook Gather all JPG files in the test set as small batchesfiles = glob.glob(os.path.join(IMAGE_DIR, "*.jpg")) if len(_buffer) > 0: Iterate over all the batches and predict_final_object = [] fp = open("predictions.json", "w") Any idea what I'm doing wrong? I'd like to see the mask coordinates in the same format as in your pycococreator. |
Hi Now i am facing the same problem.Please let me know the solution if you have fixed |
how to make this code work for multiple classes not only binary? |
|
Where can I put my input data. I mean I want to convert PNG files to json COCO dataset format, which has x,y cordinates. I want use your code but I don't know where can I put my images directory. |
Hi @kimsangseob, for converting an image you will just need to change the value of the variable ground_truth_binary_mask from : Hope it helps ! |
can u help me how to read binary images from path and convert it to json using the previous code |
can anyone help me to convert polygon format to image to show it |
how can i convert this format to mask image to show it |
I want to create a new dataset same as coco format, and now I have converted mask binary image to RLE format by using encode function in mask.py. But I don't know how to convert mask binary image or RLE format to polygon format, someone can help me? Thanks in advance.
The text was updated successfully, but these errors were encountered: