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?

5 次查看(过去 30 天)
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!

回答(1 个)

T.Nikhil kumar
T.Nikhil kumar 2023-11-21
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:
  1. DataSource - this contains the source of the image i.e the image file path.
  2. LabelDefinitions - this contains the label definitions (name, description etc)
  3. LabelData - this contains the coordinates of bounding boxes in each image.
You can use this ‘gTruth’ to create training data for your network.
  1. For creating datastores or table from your ground truth for object detection, use the ‘objectDetectorTrainingData’ function.
  2. 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:
  1. gTruth’ type object- https://www.mathworks.com/help/vision/ref/groundtruth.html
  2. objectDetectorTrainingData: https://www.mathworks.com/help/vision/ref/objectdetectortrainingdata.html
  3. pixelLabelTrainingData: https://www.mathworks.com/help/vision/ref/pixellabeltrainingdata.html
  4. 'Image Labeler’App: https://www.mathworks.com/help/vision/ug/get-started-with-the-image-labeler.html
  5. File input/output functions: https://www.mathworks.com/help/matlab/low-level-file-i-o.html?s_tid=CRUX_lftnav
Hope this helps!

标签

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by