partition - Partition label datastore - MATLAB (original) (raw)
Partition label datastore
Syntax
Description
[subds](#buouv0l-1-subds) = partition([ds](#mw%5Ff81ee525-4ced-4568-b110-24841f1b997b),[N](#buouv0l-1-N),[index](#buouv0l-1-index))
partitions a datastore ds
into N parts and returns the partition corresponding to index
.
[subds](#buouv0l-1-subds) = partition([ds](#mw%5Ff81ee525-4ced-4568-b110-24841f1b997b),'Files',[fileIndex](#mw%5F445d8729-f8e8-40f1-947a-62f2a6865c7e))
partitions the PixelLabelDatastore
by files. The partitioned datastore corresponds to the index
in theFiles
property of the datastore.
[subds](#buouv0l-1-subds) = partition([ds](#mw%5Ff81ee525-4ced-4568-b110-24841f1b997b),'Files',[filename](#buouv0l-1-filename))
partitions the PixelLabelDatastore
by files. The partitioned datastore corresponds to the file specified byfilename
.
Examples
Load training data that contains bounding boxes with labels for vehicles.
data = load('vehicleTrainingData.mat'); trainingData = data.vehicleTrainingData; blds = boxLabelDatastore(trainingData(:,2:end));
Use the partition
function to partition the box label datastore. The output contains the first 5 rows of the training data.
subds = partition(blds,59,5);
Read the data. Use the hasdata
function to check for data.
while hasdata(subds) % Read one row of box labels at a time bxLabels = read(subds); end
Input Arguments
Number of partitions to divide datastore, specified as a positive integer. To obtain an estimate for a reasonable number of partitions, use thenumpartitions function.
numWorkers = 3; p = parpool('local',numWorkers); n = numpartitions(ds,p);
parfor ii=1:n subds = partition(ds,n,ii); while hasdata(subds) data = read(subds); end end
Example: 3
Data Types: double
Index, specified as an integer. The index points to a partitioned datastore of the N number of partitioned datastores.
Example: 1
Data Types: double
File index of a file stored within the Files
property of a pixelLabelDatastore, specified as a positive integer.
Example: 1
Data Types: double
Filename, specified as a character vector.
Example: 'file1.csv'
Example: '../dir/data/file1.csv'
Example: 'hdfs://myserver:7867/data/file1.txt'
Data Types: char
Output Arguments
Output datastore, returned as a datastore object. The output datastore is of the same type as the input datastore, ds
.
Version History
Introduced in R2017b