필터 지우기
필터 지우기

trainNetwork requiring 1x2 cell array from a Transformed image datastore

조회 수: 1 (최근 30일)
Rayan
Rayan 2022년 11월 29일
편집: Sourabh 2023년 3월 23일
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.

답변 (1개)

Sourabh
Sourabh 2023년 3월 23일
편집: Sourabh 2023년 3월 23일
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.

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by