How to split of into train and test with labels data??

4 visualizaciones (últimos 30 días)
Noor Afridi
Noor Afridi el 25 de Oct. de 2020
Respondida: Vidhi Agarwal el 1 de Oct. de 2024
Hello Sir,
I have dataset of images and its labels , i want to split it into train_data, train_labels and test_data, test_labels with separated folders??

Respuestas (1)

Vidhi Agarwal
Vidhi Agarwal el 1 de Oct. de 2024
To split the dataset of images into train_data, train_labels and test_data, test_labels with separated folders, below given steps might help you in getting started:
  • Define the split ratio.
  • Shuffle the image files to ensure random distribution.
%imageFiles is a folder with all the images and labels.
numImages = length(imageFiles);
randomIndices = randperm(numImages);
  • Split the dataset
trainCount = round(trainRatio * numImages)
  • Copy the image and label to the destination directory
Hope that Helps!

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by