countEachLabel
对 ImageDatastore 标签中的文件进行计数
说明
示例
标签计数
创建一个 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
列出每个标签的文件计数。
T = countEachLabel(imds)
T = Label Count ________ _____ demos 6 imagesci 2
输入参数
imds
— 输入数据存储
ImageDatastore
对象
输入数据存储,指定为 ImageDatastore
对象。要根据图像数据创建 ImageDatastore
,请使用 imageDatastore
函数。
输出参量
T
— 标签计数表
包含两列的表
标签计数表,以包含两列的表形式返回,其中包含 imds
中每个标签的名称以及每个标签关联的文件数。
数据类型: table
扩展功能
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
此函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
版本历史记录
在 R2016a 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
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:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)