Using imageDatastore to load Input image and get output as predicted image

조회 수: 19 (최근 30일)
Rahul Gulia
Rahul Gulia 2024년 4월 8일 14:44
편집: Matt J 2024년 4월 9일 16:16
Hi,
I am trying to see if I can load few images as an input to a supervised ML model and predict an image as output of the model.
I came across imageDatastore() to load images with Label values too. I want to know how I can load my training input and output image dataset to train the supervised ML model.
Here is what I tried,
dataTrain_dir = "D:\RahulGulia\iMHS_rahul\Dataset\Dataset_Warehouse_Config_3_Tensors_cropped_Sample\Perm_tensors"
dataTrainLabel_dir = "D:\RahulGulia\iMHS_rahul\Dataset\Dataset_Warehouse_Config_3_Tensors_cropped_Sample\SINR_tensors"
imds = imageDatastore(data_dir,"LabelSource",dataTrainLabel_dir)
but got an error saying:
Error using imageDatastore
Expected input to match one of these values:
'none', 'foldernames'
Kindly let me know if I can directly train the model in MATLAB using the images as input and also as an output. Or should I send the image as matrix to the ML model. Looking forward to any kind of suggestion. I would really appreciate it.
Thank you,
Rahul

답변 (1개)

Matt J
Matt J 2024년 4월 8일 17:05
편집: Matt J 2024년 4월 8일 17:08
and predict an image as output of the model.
Labels are text scalar that are assigned to an image in a classification problem. Conversely your output is an image, so it appears you have an image-to-image regression problem. For that, you would need a CombinedDatastore:
XTrain_dir = "D:\RahulGulia\iMHS_rahul\Dataset\Dataset_Warehouse_Config_3_Tensors_cropped_Sample\Perm_tensors"
YTrain_dir = "D:\RahulGulia\iMHS_rahul\Dataset\Dataset_Warehouse_Config_3_Tensors_cropped_Sample\SINR_tensors"
xstore = imageDatastore(XTrain_dir);
ystore = imageDatastore(yTrain_dir);
xystore=combine(xstore,ystore);
Or, perhaps you have a semantic segmentation problem, in which case you could use a pixelLabelDatastore, assuming you have the Computer Vision Toolbox.
  댓글 수: 2
Rahul Gulia
Rahul Gulia 2024년 4월 8일 19:14
Thanks, I was also thinking of something like this.
But somehow, the ML and DL models are not able to access the imageDatastore created like this. Any idea, why would it do that?
Matt J
Matt J 2024년 4월 9일 14:57
편집: Matt J 2024년 4월 9일 16:16
Not without seeing the LayerGraph that you're trying to train.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by