Using imageDatastore to load Input image and get output as predicted image
4 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Matt J
on 8 Apr 2024
Edited: Matt J
on 8 Apr 2024
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!