(Not recommended) Divide image set into subsets
Create an image set.
imgFolder = fullfile(matlabroot,'toolbox','vision','visiondata','stopSignImages'); imgSet = imageSet(imgFolder);
Divide the set into two groups: one with five images and the other with the remainder of the images from imgSet.
[setA1, setA2] = partition(imgSet,5);
Randomly partition the set into three groups: one with 20% of the images, the second group with 30%, and the third group with 50%.
[setB1, setB2, setB3] = partition(imgSet, [0.2, 0.3],'randomized');
imgSet— Image set
imageSetobject | array of
Image set, specified as a scalar
imageSet object or an array
groupSizes— Group size
Group size of images, specified as a positive integer or vector of
positive integers. The number of output arguments must be between 1 and
[20 60] returns 20 images in
set1, 60 images in
any remaining images in
groupPercentages— Group size percentage
Group size of images by percentage.
[0.1 0.5] returns 10% of images in
set1, 50% in
set2, and the
method— Image selection method
Image selection method, specified as either
'randomized'. When you set
images are randomly selected to form the new sets. When you set
images are selected sequentially.
partitionis not recommended
Not recommended starting in R2016b