Transfer learning for 2D image using Alexnet
3 次查看(过去 30 天)
显示 更早的评论
Hello, I am trying to do as following video: https://www.mathworks.com/videos/transfer-learning-with-neural-networks-in-matlab-1492007175092.html
but my data in this case is 2D data, so the network responded some error.
Error using trainNetwork (line 154)
The training images are of size 227x227x1 but the input layer expects images of size 227x227x3.
I have tried to convert the image to 3D image in the file @readFunctionTrain but it does not work (see attached image).
I am not sure about the function @readFunctionTrain but it seems not allow me to do any change.
Have someone ever face this problem?
采纳的回答
Mohammad Sami
2020-8-22
编辑:Mohammad Sami
2020-8-22
Another option would be for you to use the augmented image data store function. It includes both resizing and grey to RGB functionality.
if true
auimds = augmentedImageDatastore([224,224],imds,'ColorPreprocessing','gray2rgb');
end
更多回答(1 个)
Walter Roberson
2020-8-19
You can use a transform() of your datastore https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.transform.html
Or you can use an Augmented Image Datastore, as that has an option to automatically adjust the color.
2 个评论
Mohammad Sami
2020-8-22
The transform function was introduced in R2019a. If you are unable to upgrade, the alternative would be to set a custom ReadFcn function for your imageDatastore
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!