Azzera filtri
Azzera filtri

trainNetwork requiring 1x2 cell array from a Transformed image datastore

2 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Sourabh
Sourabh il 23 Mar 2023
Modificato: Sourabh il 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.

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by