Effacer les filtres
Effacer les filtres

trainNetwork requiring 1x2 cell array from a Transformed image datastore

2 vues (au cours des 30 derniers jours)
Rayan
Rayan le 29 Nov 2022
Modifié(e) : Sourabh le 23 Mar 2023
I am trying to train a network using the deep network designer. I started by creating a datastore and then transforming the images to grayscale. These images are then sent to the deep network designer. However, I keep getting an error saying that I need a 1x2 cell array despite using an image datastore.
Below is the code used before:
ds = imageDatastore("Training","IncludeSubfolders",true, "LabelSource","foldernames");
dsnew = transform(ds,@(x) rgb2gray(x));
The images are all 512 x 512, so in ImageInputLayer I have the InputSize set to 512 x 512 x 1.

Réponses (1)

Sourabh
Sourabh le 23 Mar 2023
Modifié(e) : Sourabh le 23 Mar 2023
Hi Rayan,
The error message you are seeing might be because the output of transform is not returning the data in the expected format for your neural network.
The “transform function outputs a TransformedDatastore object. With the Deep Network Designer, you can import and train any datastore object that works with the trainNetwork function.
To pre-process images according to your own pipeline, try using the transform and combine functions.
For more information on pre-processing images for deep learning applications, see Preprocess Images for Deep Learning.
As a last resort solution for this issue, you could consider using the “Image Batch Processor” app from the Image Processing Toolbox to perform any pre-processing operations on your image dataset and save them to your local disk.
However, I would only recommend this option if your dataset were small, and you would not mind having a second copy of the images on your disk.

Produits


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by