フィルターのクリア

How to use data from ImageLabeler in the DeepNetworkDesigner app?

14 ビュー (過去 30 日間)
Jacek
Jacek 2023 年 11 月 20 日
回答済み: T.Nikhil kumar 2024 年 1 月 3 日
I am trying to create a deep network model for semantic segmentation. So in the Image Labeler app I created a pixel-type label and manually labelled several images. I want to use the data in the Deep Network Designer app. However, something that should be fairly easy seems very hard to do. The output format (when I use the export labels button) is not compatible with the expected format in the Deep Network Designer app. It seems that you need to use a set of functions to convert the format to something acceptable by the Deep Network Designer app. The tutorials that I found are not very helpful. Perhaps there is a simple procedure that someone could share?
  2 件のコメント
Jonas
Jonas 2023 年 11 月 23 日
bard tells you:
The Image Labeler app and the Deep Network Designer app use different formats for storing labeled image data. The Image Labeler app stores labels in a MATLAB struct, while the Deep Network Designer app expects labels to be stored in a MATLAB matrix. To convert labels from the Image Labeler app to a format compatible with the Deep Network Designer app, you can use the following steps:
  1. Export labels from the Image Labeler app: Open the Image Labeler app and select the image dataset you want to export labels for. Click the "Export Labels" button and select the "MATLAB struct" option. This will create a MATLAB struct containing the labels for the image dataset.
  2. Convert labels to MATLAB matrix: Load the MATLAB struct containing the labels into your MATLAB workspace. Use the following code to convert the labels to a MATLAB matrix:
labels = [];
for i = 1:length(data.imageData)
label = data.imageData(i).pixelLabelData;
labels = [labels; label(:)];
end
This code will create a MATLAB matrix labels containing the labels for the image dataset.
  1. Save labels to MAT file: Save the MATLAB matrix labels to a MAT file. This will create a file that can be imported into the Deep Network Designer app.
  2. Import labels into Deep Network Designer app: Open the Deep Network Designer app and click the "Import Image Data" button. Select the MAT file you created in step 3 and click the "OK" button. This will import the labels into the Deep Network Designer app.
Once you have completed these steps, you will be able to use the labels in the Deep Network Designer app to train a deep network model for semantic segmentation.
Jacek
Jacek 2023 年 11 月 27 日
Thank you for the reply.
Unfortunately in the ImageLabeler app I can't see an option "Matlab struct" under the export button. I can only see Labels - to file, Labels - to workspace and Label definitions options. The first two create a gTruth.mat file with a gTruth object. And within the object there is no imageData container/object (if I consider that gTruth==data).
Perhaps I am looking in a wrong place ... (I am using R2023b).
Anyway, I would expect the output of one app to be directly acceptable by another app.

サインインしてコメントする。

回答 (1 件)

T.Nikhil kumar
T.Nikhil kumar 2024 年 1 月 3 日
Hello Jacek,
As per my understanding, you have labelled images using the Image Labeler App and want to know how to use these labels for training a network using the Deep network Designer App.
I would suggest you try the following steps for this purpose:
  1. In the Image Labeler app, export the labels as a ‘gTruth’ type object to your workspace using the ‘To Workspace’ option under the ‘Export’ button in the ‘Image Labeler’ tab.
  2. Create a ‘pixelLabelDatastore’ object using the ‘pixelLabelDatastore’ command with the ‘gTruth’ object as the argument.
pxl=pixelLabelDatastore(gTruth);
3. In the Deep Network Designer app, go to the ‘data’ tab and click on ‘Import Custom Data’ option under ‘Import Data’ button. Now select the pixelLabelDatastore, that we created, as Training data.
Refer to the following documentation to learn about the ‘pixelLabelDatastore’ function:
Hope this helps!

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by