- binary images (PNG) (TIFF)
- grayscale images (GIF) (PNG) (TIFF) (JPG but quite rare)
- pseudocolor images (GIF) (PNG) (TIFF)
- CMYK images (TIFF)
- RGBA images (TIFF) (possible with PNG even if not officially supported; PNG prefers RGB+A)
I'm trying to apply the Alexnet transfer learning example but it's not working with my dataset
1 次查看(过去 30 天)
显示 更早的评论
I'm trying to follow the steps in this example Transfer learning using AlexNet using my set of images but it's giving me this error
Error using trainNetwork (line 154)
augmentedImageSource cannot form MiniBatches of data because input image sizes differ in 3rd dimension. Consider
using 'ColorPreprocessing' option to ensure all augmented images have same number of channels.
Error in TrainAlexnet (line 42)
netTransfer = trainNetwork(augimdsTrain,layers,options);
Caused by:
Error using augmentedImageDatastore/applyAugmentationPipeline (line 335)
augmentedImageSource cannot form MiniBatches of data because input image sizes differ in 3rd dimension.
Consider using 'ColorPreprocessing' option to ensure all augmented images have same number of channels.
I even resized all images to [227 227 3], same error. I also had the same problem with GoogLeNet
0 个评论
采纳的回答
Walter Roberson
2018-9-4
imresize does not accept [227 227 3] as a parameter. You would have used imresize with [227 227] as a parameter. However, imresize does not change the number of color channels.
In short: some of your files are not RGB images. They are one of:
JPEG 2000 should also be in that table somewhere, but I do not remember exactly what it supports.
Possibly you have some JPEG that you are thinking are grayscale. Grayscale JPEG are very very uncommon: I have only encountered one in about 20 years that was not a test image to prove that it could be done. Nearly all JPEG images that appear to be grayscale are instead RGB images.
2 个评论
更多回答(0 个)
另请参阅
类别
在 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!