- Begin by exporting the labels from your dataset to a .mat file or workspace. This process involves creating a ground truth object, which can be achieved using the "groundTruth" function. Detailed instructions on exporting the data and creating the ground truth object can be found in the documentation provided at the following link: https://www.mathworks.com/help/vision/ref/groundtruth.html
- Once you have successfully created the ground truth object, the next step involves exporting the data to a custom JSON file format. This can be accomplished using the "exportGroundTruthToJSON" function. For a comprehensive understanding of how to utilize this function, please refer to the documentation provided at the following link: https://www.mathworks.com/help/vision/ug/export-ground-truth-object-to-custom-and-coco-json-files.html#ExportGroundTruthObjectToCustomAndCOCOJSONFilesExample-3
Labelled 2D Matrix to JSON format for image segmentation deeplearning
5 views (last 30 days)
Show older comments
Dear community,
I am trying to train a neural network for 2D panoptic image segmentation that uses JSON formatted label data as input. I look at very complex irregular shapes (metallurgical micrographs) and to avoid manual labelling, I'd like to use deterministic image analysis instead.
My thresholding-based instance segmentation method generates 2D matrices of the same dimensions as the original image and allocates each pixel to a target class by the same number, objects are identified as adjacent same numbers. I base this on the label output L of bwboundaries for each target class: [B,L]= bwboundaries()
As a snapshot, my labelled matrix/mask looks something like this (indicating 3 target classes and in this case 4 distinct objects):
[1 1 2 1 1;
1 2 2 2 1;
2 2 3 3 3]
Is there a way to convert such labels/masks, either the individual (binary) labels per target class or the complete labelled matrix, into a JSON format that I can use to train a neural network?
Thank you
0 Comments
Answers (1)
Shreeya
on 14 Sep 2023
I understand that you have a labeled dataset for image segmentation training task and would want to convert it to JSON format. You can follow the steps outlined below to achieve it:
I hope this helps!
0 Comments
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!