主要内容

地面

Ground truth label data

Description

地面object contains information about the data source, label definitions, and marked label annotations for a set of ground truth labels. You can export or import a地面object from theImage LabelerVideo Labelerapps.

Creation

To export a地面来自标签应用程序的对象,在App Toolstrip上,选择Export Labels>To Workspace。这app exports the object to the MATLAB®工作区。创建一个地面object programmatically, use the地面function (described here).

Description

example

gTruth= groundTruth(数据源,Labeldefs,labelData)returns an object containing ground truth labels that can be imported into theImage LabelerVideo Labelerapps.

  • 数据源指定地面真相数据的来源,并设置数据源property.

  • Labeldefsspecifies the label, sublabel, and attribute definitions of the ground truth data and sets thelabeldefinitionsproperty.

  • labelData指定标记标签的识别信息,位置和时间戳,并设置Labeldataproperty.

Properties

expand all

地面真相数据的来源, specified as a地面图目的。该对象包含描述视频,图像序列或自定义数据源的信息,从那里标记了地面真相数据。

To access images from the original data source, use录像师或者成像。You can also use a custom read function. For more details, see利用Custom Image Source Reader for Labeling

此属性仅阅读。

标签定义,指定为表。要创建此表,请使用以下选项之一。

  • 在其中一个标签应用程序中,创建标签定义,然后将其导出为地面目的。

  • 利用alabelDefinitionCreator对象生成标签定义表。如果将此表保存到垫子文件中,则可以通过选择标签定义将标签定义加载到标签应用程序中Load>标签定义from the app toolstrip.

  • 在MATLAB命令行中创建标签定义表。

该表描述了在该表中指定的表的必需列labeldefinitionsproperty.

柱子 Description 必需的或者Optional
Name Strings or character vectors specifying the name of each label definition.

必需的

类型 标签enumerations that specify the type of each label definition, such asRectangle或者Scene

必需的

LabelColor 1-by-3 row vectors of RGB triplets that specify the colors of the label definitions. Values are in the range [0, 1]. The color yellow (RGB triplet [1 1 0]) is reserved for the color of selected labels in the labeling apps.

Optional

当您在标签应用中定义标签时,必须指定颜色。因此,导出的标签定义表总是包含此列。

当您创建标签定义时labelDefinitionCreator无需指定颜色的对象,返回的标签定义表包含此列,但所有列值都是空的。

PixelLabelID Scalars, column vectors, orM-by-3 matrices of integer-valued label IDs.PixelLabelID指定用于表示标签定义的像素标签值。像素标签ID值必须在0到255之间。

Optional

当您在标签应用中定义像素标签或labelDefinitionCreatorobject, the generated label definitions table includes this column.

在MATLAB命令行中创建标签定义表时,如果您设置类型tolabelType.pixellabelfor any label, then this column is required.

团体 字符串或字符向量指定每个标签定义所属的组。

Optional

If you create the label definitions table at the MATLAB command line, you do not need to include a团体column.

如果您从标签应用程序导出标签定义或使用labelDefinitionCreatorobject, the label definitions table includes this column, even if you did not specify groups. The app assigns each label definition a团体value of'None'

Description Strings or character vectors that describe each label definition.

Optional

If you create the label definitions table at the MATLAB command line, you do not need to include aDescriptioncolumn.

如果您从标签应用程序导出标签定义或使用labelDefinitionCreator对象,标签定义表包括此列,即使您未指定描述。这Description对于这些标签定义是一个空的字符向量。

等级制度 每个标签定义中包含sublabel和属性数据的结构。作为一个例子等级制度format, see开始使用图像标签或者Get Started with the Video Labeler

Optional

In labeling apps, when you define sublabels or attributes, the exported地面object includes this column.

例如,考虑一个带有标签定义的表格Sky,Vegetation,车道,StopSign, 和Vehicle, 和that was exported from theVideo Labeler应用程序。

  • 标签定义包括像素标签,因此该表包括一个PixelLabelIDcolumn.

  • Two of the labels contain attributes, so the app created a等级制度适用于所有标签定义的列。

  • 标签定义没有分配的组,因此团体列是'None'for all label definitions.

Note

标签应用程序只能加载具有1到255之间的像素ID的像素数据。

此属性仅阅读。

每个ROI和场景标签的标签数据, specified as a桌子for image collections or atimetablefor videos or image sequences. Each column ofLabeldata保留单个标签定义的标签,并对应于Name每行的值labeldefinitions。这seLabeldata描述表的元素。标签类别指定为标签enumerations.

一个lternatively, for ROI label data that is grouped by label type, a single column labeledRoilabeldata, can be used and specified as a structure containing at least one label type,矩形,多边形,lineata, 或者ProjCuboidData

表中描述了每个标签类型的存储格式。

标签类型 每个时间戳上标签的存储格式
标签。Rectangle

M-by-4 numeric matrix of the form[X,Y,W,H], where:

  • Mis the number of labels in the frame.

  • xy指定矩形的左上角。

  • w指定矩形的宽度,这是沿着矩形的长度x-axis.

  • hspecifies the height of the rectangle, which is its length along they-axis.

标签。Cuboid

M-by-9 numeric matrix with rows of the form[xctr, yctr, zctr, xlen, ylen, zlen, xrot, yrot, zrot], where:

  • Mis the number of labels in the frame.

  • xctr,yctr, 和zctr指定长方体的中心。

  • xlen,ylen, 和zlen指定沿x-axis,y-axis, andz-axis, respectively, before rotation has been applied.

  • Xrot,yrot, 和zrotspecify the rotation angles for the cuboid along thex-axis,y-axis, andz- 轴分别。这些角度在其相应轴的正向方向上进行顺时针阳性。

该图显示了这些值如何确定长方体的位置。

Cuboid with center point, lengths, and rotation angles labeled

labelType.projectedCuboid

M-8形式的by-8向量[X1,Y1,W1,H1,X2,Y2,W2,H2], where:

  • Mis the number of labels in the frame.

  • X1,Y1specifies thex,ycoordinates for the upper-left location of the front-face of the projected cuboid

  • w1指定了预计的长方体的前面宽度。

  • h1指定了预计的长方体的前面高度。

  • x2, y2specifies thex,ycoordinates for the upper-left location of the back-face of the projected cuboid.

  • w2specifies the width for the back-face of the projected cuboid.

  • h2specifies the height for the back-face of the projected cuboid.

该图显示了这些值如何确定长方体的位置。

标记为投影的长方体

labelType.line

M-by-1 vector of cell arrays, whereMis the number of labels in the frame. Each cell array contains anN-by-2 numeric matrix of the form[x1 y1; x2 y2; ... ; xN yN]forN多线中的点。

labelType.pixellabel

Label data for all pixel label definitions is stored in a singleM-by-1PixelLabelDatacolumn forMimages or frames. Each element contains a filename for a pixel label image. A pixel label image describes the label or labels contained in the corresponding image. The labels can be described as a 1- or 3- channel label matrix. To usePixelLabelDatawith any of the labeler apps, you must use a single-channel label matrix, where the values are of typeuint8。You can convert a 3-channel pixel label data matrix to a single-channel label matrix programmatically to use with the labeler apps.

labelType.polygon

M-by-1 vector of cell arrays, whereMis the number of labels. Each cell array contains anN-by-2 numeric matrix of the form[x1 y1; x2 y2; ... ; xN yN]forN多边形中的点。

labelType.custom 标签与时间表中指定的准确存储。如果您导入地面Multisignalobject containing custom label data into theGround Truth Labelerapp, this data is not imported into the app. Use custom data when gathering label data for training and combining it with data labeled in the app.

Supported GroundTruth Objects

Video Labeler App Image Labeler App
数据源 视频文件,图像序列文件夹,自定义阅读器 图像文件
Label definitions Rectangle,Line,PixelLabel, 或者Scenelabel types Rectangle,Line,PixelLabel, 或者Scenelabel types
Label data 时间表Rectangle,Line,PixelLabel, 或者Scenelabel types Table (no timetable) forRectangle,Line,PixelLabel, 或者Scenelabel types

添加不是ROI的地面真相数据(Rectangle,Line,PixelLabel) orScenelabel category to a地面对象,提供标签定义标签that isCustom。将其加载到标签应用程序中时,自定义数据不可见。

Object Functions

SelectLabelsByGroup Select ground truth labels by label group
selectlabelsbytype Select ground truth labels by label type
SelectLabelsByName 通过标签名称选择地面真相标签
变化膜 改变地面实况数据文件路径
gatherLabelData 从地面真相收集标签数据

Examples

全部收缩

从图像集合中创建数据源。

data = load('stopSignsAndCars.mat'); imageFilenames = data.stopSignsAndCars.imageFilename(1:2)
imageFilenames =2x1 cell{'stopSignImages/image001.jpg'} {'stopSignImages/image002.jpg'}
imageFileNames = fullfile(toolboxDir('vision'),'visiondata',imageFilenames); dataSource = groundTruthDataSource(imageFilenames);

定义用于指定地面真相的标签。利用labelDefinitionCreator创建标签定义表。

LDC = labeldefinitionCreator();Addlabel(LDC,'停止标志',labelType.Rectangle); addLabel(ldc,'carRear',labelType.Rectangle); labelDefs = create(ldc)
Labeldefs=2×5桌Name Type LabelColor Group Description ____________ _________ __________ ________ ___________ {'stopSign'} Rectangle {0x0 char} {'None'} {' '} {'carRear' } Rectangle {0x0 char} {'None'} {' '}

初始化矩形ROI的标签数据。

stopSignTruth = {[856 318 39 41];[445 523 52 54]}; carRearTruth = {[398 378 315 210];[332 633 691 287]};

Construct a table of label data.

labelNames = {'停止标志';'carRear'};labelData = table(stopSignTruth,carRearTruth,'VariableNames',labelNames)
labelData=2×2桌stopSign carRear  _________________ ___________________ {[856 318 39 41]} {[398 378 315 210]} {[445 523 52 54]} {[332 633 691 287]}

创建一个ground truth object.

gTruth = groundTruth(dataSource,labelDefs,labelData)
gTruth = groundTruth with properties: DataSource: [1x1 groundTruthDataSource] LabelDefinitions: [2x5 table] LabelData: [2x2 table]

创建一个地面对象存储代表标记道路车道的数据。

从图像创建数据源。

dataSource = groundTruthDataSource({'stopSignTest.jpg'});

定义用于指定地面真相的标签。利用labelDefinitionCreator创建标签定义表。

LDC = labeldefinitionCreator();Addlabel(LDC,'车道',labelType.line);labeldefs =创建(LDC);

一个ssign two lane markers in the image.

laneMarkerTruth = {[257 254;311 180] [327 183;338 205;374 250]};

Construct a table of label data.

labelNames = {'车道'};labelData = table(laneMarkerTruth,'VariableNames',labelNames)
labelData=桌子车道____________________________ {2x2 double} {3x2 double}

创建一个地面目的。

gTruth = groundTruth(dataSource,labelDefs,labelData)
gTruth = groundTruth with properties: DataSource: [1x1 groundTruthDataSource] LabelDefinitions: [1x5 table] LabelData: [1x1 table]

创建一个地面对象存储代表场景部分的数据。

创建一个数据源。

dataSource = groundTruthDataSource({'VisionTeam.jpg'});

利用labelDefinitionCreator创建标签定义表。Define labels,'Person''背景'。将其相应标签类型分配为PixelLabel

LDC = labeldefinitionCreator();Addlabel(LDC,'Person',labelType.pixellabel);Addlabel(LDC,'背景',labelType.pixellabel);labeldefs =创建(LDC)
Labeldefs=2×6桌Name Type LabelColor PixelLabelID Group Description ______________ __________ __________ ____________ ________ ___________ {'Person' } PixelLabel {0x0 char} {[1]} {'None'} {' '} {'Background'} PixelLabel {0x0 char} {[2]} {'None'} {' '}

为图像指定像素标签数据的位置。

datafile = {'VisionTeamPixellabels.png'}
datafile =1x1单元格数组{'VisionTeamPixellabels.png'}

为像素标签数据构建标签数据表。

labelData = table(dataFile,'VariableNames',{'PixelLabelData'})
labelData=桌子pixellabeldata _____________________________________________________________________________________________________

创建一个地面目的。

gTruth = groundTruth(dataSource,labelDefs,labelData)
gTruth = groundTruth with properties: DataSource: [1x1 groundTruthDataSource] LabelDefinitions: [2x6 table] LabelData: [1x1 table]

创建一个data source from a video.

videoName ='caltech_cordova1.avi'; dataSource = groundTruthDataSource(videoName);

定义用于指定地面真相的标签。利用alabelDefinitionCreator对象创建标签定义表。

LDC = labeldefinitionCreator();Addlabel(LDC,'Cars',labelType.Rectangle); addLabel(ldc,“ lanemarkers”,labelType.line);labeldefs =创建(LDC)
Labeldefs=2×5桌Name Type LabelColor Group Description _______________ _________ __________ ________ ___________ {'Cars' } Rectangle {0x0 char} {'None'} {' '} {'LaneMarkers'} Line {0x0 char} {'None'} {' '}

Create label data for cars and lane markers.

numrows = numel(datasource.timestamps);CARSTRUTH = Cell(Numrows,1);lanemarkerTruth = cell(numrows,1);

一个dd two car labels and two lane markers to the first frame.

carsTruth{1} = [182 186 31 22;404 191 53 34]; laneMarkerTruth{1} = {[257 254;311 180] [327 183;338 205;374 250]};

创建一个桌子of label data.

labelNames = {'Cars',“ lanemarkers”};labeldata = table(carstruth,lanemarkertruth,'VariableNames',labelNames);

创建一个地面目的。To import this object into a labeling app, select an option from the打开>导入标签menu.

gTruth = groundTruth(dataSource,labelDefs,labelData)
gTruth = groundTruth with properties: DataSource: [1x1 groundTruthDataSource] LabelDefinitions: [2x5 table] LabelData: [250x2 timetable]

提示

  • 地面基于视频的数据源的对象依赖于操作系统的视频阅读功能。一个地面使用视频数据源创建的对象仅对用于创建它的同一平台保持一致。创建独立于平台的地面对象,将视频转换为一系列图像,并包含带有图像序列的相关时间戳。

Version History

Introduced in R2017a