- 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 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mohamed Amine Habch
el 4 de Sept. de 2018
Comentada: Hashna Rasheed
el 2 de Abr. de 2022
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 comentarios
Respuesta aceptada
Walter Roberson
el 4 de Sept. de 2018
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!