Help CenterHelp Center
Count files in ImageDatastore labels
T = countEachLabel(imds)
example
T= countEachLabel(imds)returns a summary table of the labels inimdsand the number of files associated with each.
T= countEachLabel(imds)
T
imds
collapse all
Create anImageDatastoreobject and label each image according to the folder it is in.
ImageDatastore
imds = imageDatastore(fullfile(matlabroot,'toolbox','matlab', {'demos','imagesci'}),...'LabelSource','foldernames','FileExtensions', {'.jpg','.png','.tif'})
imds = ImageDatastore with properties: Files: { ' ...\matlab\toolbox\matlab\demos\cloudCombined.jpg'; ' ...\matlab\toolbox\matlab\demos\example.tif'; ' ...\matlab\toolbox\matlab\demos\landOcean.jpg' ... and 5 more } Labels: [demos; demos; demos ... and 5 more categorical] ReadFcn: @readDatastoreImage
List the file count for each label.
T = Label Count ________ _____ demos 6 imagesci 2
Input datastore, specified as anImageDatastoreobject. To create anImageDatastorefrom your image data, use theimageDatastorefunction.
imageDatastore
表的标签数,返回ed as a two-column table containing the name of each label inimdsand the number of files associated with each label.
Data Types:table
table
backgroundPool
ThreadPool
This function fully supports thread-based environments. For more information, seeRun MATLAB Functions in Thread-Based Environment.
Introduced in R2016a
ImageDatastore|splitEachLabel|datastore
splitEachLabel
datastore
You have a modified version of this example. Do you want to open this example with your edits?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office