Resizing images to 224*224 for training VGG16 Model
Mostrar comentarios más antiguos
Hi I'm training a VGG16 Model in the latest version of MATLAB R2023-a and I keep getting the same resizing error. I'm wondering if there is a new way to resize the images in a datastore in MATLAB or if the error is really on my improper execution of resizing in my code.
I have a folder of dataset with two sub folders which are my classes. This is the first part of my code with resizing:
% Load the dataset
imds = imageDatastore('DataSetFolder', 'IncludeSubfolders', true, 'LabelSource', 'foldernames');
% Define the desired input size
inputSize = [224 224];
% Resize images to 224x224
inputSize = [224 224];
augmentedIMDS = augmentedImageDatastore(inputSize, imds);
% Use the transform function to resize images
augmentedIMDS = transform(imds, @(x)imresize(x, inputSize));
% Split the dataset into training, validation, and test sets
[trainingData, validationData, testingData] = splitEachLabel(augmentedIMDS, 0.8, 01, 01);
% Load the pretrained VGG16 model
net = vgg16;
I keep getting error for this part of the code:
% Split the dataset into training, validation, and test sets
[trainingData, validationData, testingData] = splitEachLabel(augmentedIMDS, 0.8, 01, 01);
when i change the directory to imds the error is about resizing "Incorrect input size. the input size must have a size of [224 224 3]" and when i change it to augmentedIMDS the error is "Incorrect number or types of inputs or outputs for function 'splitEachLabel'."
Respuesta aceptada
Más respuestas (1)
asma abdulrahman
el 4 de En. de 2025
0 votos
how i instell my network
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!