Main Content

countEachLabel

ImageDatastore 레이블의 파일 개수 계산

설명

예제

T = countEachLabel(imds)imds에 포함된 레이블을 보여주는 요약 테이블과 각 레이블에 연결된 파일의 개수를 반환합니다.

예제

모두 축소

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    

입력 인수

모두 축소

입력 데이터저장소로, ImageDatastore 객체로 지정됩니다. 이미지 데이터에서 ImageDatastore를 생성하려면 imageDatastore 함수를 사용하십시오.

출력 인수

모두 축소

레이블 개수를 보여주는 테이블로, imds에 포함된 각 레이블의 이름과 각 레이블에 연결된 파일의 개수를 포함하는 2열 테이블로 반환됩니다.

데이터형: table

확장 기능

버전 내역

R2016a에 개발됨