Using imageDatastore to load Input image and get output as predicted image
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Matt J
2024-4-8
编辑:Matt J
2024-4-8
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!