- Organize the images in separate folders according to classes or categories.
- Use the "imageDatastore" function in MATLAB to import the Dataset. This will import all the images and set the labels according to the folder names. Refer to the following code.
how to import images into the rquired type of datasets to "inputs" and "targets" in neural network pattern recognition
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
i need help into how to upload my images around 6000 images into the "inputs" and "targets" i need to know how to convert the images into the required datasets type
0 comentarios
Respuestas (1)
Milan Bansal
el 20 de Sept. de 2023
Hi,
As per my understanding, you want to import the image dataset into MATLAB and split the dataset into "inputs" and "targets".
Kindly follow the steps given below in order to import the image dataset:
dataPath = 'pathToTheDataset'; % path to the folder containing your images
% Create an ImageDatastore object
imds = imageDatastore(dataPath, 'LabelSource', 'foldernames', "IncludeSubfolders",true);
3. The images and the corresponding labels can be extracted using the following code:
imageFiles = imds.Files;
Labels = imds.Labels;
4. The dataset may be splitted into "trainSet" and "testSet" using "splitEachLabel" function in MATLAB.
% Specify the training and testing split ratio
trainRatio = 0.9;
testRatio = 0.1;
% Split the dataset
[trainSet, testSet] = splitEachLabel(imds, trainRatio, testRatio, 'randomized');
Refer to the following documentation link to learn more about "imageDatastore" function:
Hope it helps!
0 comentarios
Ver también
Categorías
Más información sobre Deep Learning Toolbox 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!