How can I export gTruth data from image labeler into the image file that was labeled and a .txt file of the position of the label?
Show older comments
I'm very new to the world of coding and I don't know much. Once I've labelled the images in label imager I export it, but this is where I'm stuck, how am I supposed to use this .mat file and how do I get what I need out of it. It comes out as a gTruth in the workspace but how can I actually use the data in it? Any and all help would be appreciated!
Answers (1)
T.Nikhil kumar
on 21 Nov 2023
1 vote
Hello Morteza,
I understand that you want to know how to work with the ‘gTruth’ type object obtained from the Image Labeler App. The ground truth object from the Image labeler App contains the following properties:
- DataSource - this contains the source of the image i.e the image file path.
- LabelDefinitions - this contains the label definitions (name, description etc)
- LabelData - this contains the coordinates of bounding boxes in each image.
You can use this ‘gTruth’ to create training data for your network.
- For creating datastores or table from your ground truth for object detection, use the ‘objectDetectorTrainingData’ function.
- For creating datastores for semantic segmentation, you can use the ‘pixelLabelTrainingData’ function.
Alternatively, you can directly export your data in the form of ‘table’ from the Image Labeler app instead of ‘gTruth’ and this can be used as training data for networks.
You can write the data about bounding boxes coordinates(position) into a ‘.txt’ file using the ‘fopen’, ‘fprintf’ and ‘fclose’ functions.
Refer to the following documentation for better understanding:
- ‘gTruth’ type object- https://www.mathworks.com/help/vision/ref/groundtruth.html
- objectDetectorTrainingData: https://www.mathworks.com/help/vision/ref/objectdetectortrainingdata.html
- pixelLabelTrainingData: https://www.mathworks.com/help/vision/ref/pixellabeltrainingdata.html
- 'Image Labeler’App: https://www.mathworks.com/help/vision/ug/get-started-with-the-image-labeler.html
- File input/output functions: https://www.mathworks.com/help/matlab/low-level-file-i-o.html?s_tid=CRUX_lftnav
Hope this helps!
Categories
Find more on Ground Truth Labeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!