Metadata proto文件
“opensource/bin/”目录下的protoc为Google Protobuf的编译工具,若用户在插件中使用了自定义的数据结构,protoc可以将其.proto文件生成相应的接口代码。
Google Protobuf数据结构定义文件(MxpiDumpData.proto)
syntax = "proto3";
package MxTools;
message MxpiDumpData
{
Buffer buffer = 1;
repeated MetaData metaData = 2;
}
message Buffer
{
bytes bufferData = 1;
}
message MetaData
{
string key = 1;
string content = 2;
string protoDataType = 3;
}
Google Protobuf数据结构定义文件(MxpiDataType.proto)
syntax = "proto3";
package MxTools;
// 用于存放视频和图像帧,包含帧信息,数据信息。
message MxpiFrame
{
MxpiFrameInfo frameInfo = 1;
MxpiVisionList visionList = 2; // 为了和VPC统一,使用list。
}
message MxpiFrameInfo // 帧信息
{
uint32 channelId = 1;
uint32 frameId = 2;
bool isEos = 3;
}
message MxpiVisionList // 视频、图像数据列表
{
repeated MxpiVision visionVec = 1;
}
message MxpiVision // 视频、图像数据结构
{
repeated MxpiMetaHeader headerVec = 1; //存放插件信息的vector
MxpiVisionInfo visionInfo = 2;
MxpiVisionData visionData = 3;
}
message MxpiMetaHeader // 数据结构头,用于序列化
{
string parentName = 1; //此变量在后续版本中将会被弃用,请使用“dataSource”
int32 memberId = 2; //MxpiVisionList中对应存放的MxpiVision索引
string dataSource = 3; //依赖数据的索引名,通过该索引获取依赖的元数据
}
enum MxpiMemoryType {
MXPI_MEMORY_HOST = 0;
MXPI_MEMORY_DEVICE = 1;
MXPI_MEMORY_DVPP = 2;
MXPI_MEMORY_HOST_MALLOC = 3;
MXPI_MEMORY_HOST_NEW = 4;
}
enum MxpiDataType { // 数据类型,包括8位无符号整型类型和32位浮点类型
MXPI_DATA_TYPE_UINT8 = 0;
MXPI_DATA_TYPE_FLOAT32 = 1;
}
message MxpiVisionInfo // 视频、图像描述信息
{
uint32 format = 1; //描述图像的格式,具体请参见DvppWrapper.h的MxbasePixelFormat
uint32 width = 2;
uint32 height = 3;
uint32 widthAligned = 4;
uint32 heightAligned = 5;
uint32 resizeType = 6; //描述缩放类型,具体请参见MxPluginsUtils.h的RESIZETYPE
float keepAspectRatioScaling = 7; //缩放比例,取值在[1/32, 16]
repeated MxpiVisionPreProcess preprocessInfo = 8;
}
message MxpiVisionPreProcess // 图像前处理信息。例如图像宽高、抠图坐标、贴图坐标
{
uint32 widthSrc = 1;
uint32 heightSrc = 2;
uint32 cropLeft = 3;
uint32 cropRight = 4;
uint32 cropTop = 5;
uint32 cropBottom = 6;
uint32 pasteLeft = 7;
uint32 pasteRight = 8;
uint32 pasteTop = 9;
uint32 pasteBottom = 10;
uint32 interpolation = 11;
string elementName = 12;
}
message MxpiVisionData // 视频、图像数据内容
{
uint64 dataPtr = 1; // 视频、图像内存指针
int32 dataSize = 2;
uint32 deviceId = 3;
MxpiMemoryType memType = 4;
uint64 freeFunc = 5; // 视频、图像内存销毁函数
bytes dataStr = 6; // bytes数据类型 序列化成JSON时会自动进行base64编码
MxpiDataType dataType = 7;
uint64 matPtr = 8;
}
message MxpiObjectList // 目标列表
{
repeated MxpiObject objectVec = 1;
}
message MxpiObject // 目标数据结构
{
repeated MxpiMetaHeader headerVec = 1;
float x0 = 2;
float y0 = 3;
float x1 = 4;
float y1 = 5;
repeated MxpiClass classVec = 6; // 类别信息数据结构,此处“MxpiMetaHeader”无效
MxpiImageMask imageMask = 7; // 图像语义分割数据信息
}
message MxpiImageMaskList // 图像语义分割数据列表
{
repeated MxpiImageMask imageMaskVec = 1;
}
message MxpiImageMask // 图像语义分割数据信息。例如数据的类别、形状、类别信息
{
repeated MxpiMetaHeader headerVec = 1;
repeated string className = 2;
repeated int32 shape = 3;
int32 dataType = 4;
bytes dataStr = 5;
}
message MxpiClass // 类别信息数据结构
{
repeated MxpiMetaHeader headerVec = 1;
int32 classId = 2;
string className = 3;
float confidence = 4;
}
message MxpiClassList // 类别信息列表
{
repeated MxpiClass classVec = 1;
}
message MxpiAttributeList // 属性信息列表
{
repeated MxpiAttribute attributeVec = 1;
}
message MxpiAttribute // 属性信息数据结构
{
repeated MxpiMetaHeader headerVec = 1;
int32 attrId = 2;
string attrName = 3;
string attrValue = 4;
float confidence = 5;
}
message MxpiTrackLetList
{
repeated MxpiTrackLet trackLetVec = 1;
}
message MxpiTrackLet
{
repeated MxpiMetaHeader headerVec = 1;
uint32 trackId = 2;
uint32 age = 3; // 目标“存活”帧数
uint32 hits = 4; // 目标被成功匹配帧数
int32 trackFlag = 5; // 状态
}
message MxpiTensorPackageList // 模型Tensor组合列表
{
repeated MxpiTensorPackage tensorPackageVec = 1;
}
message MxpiTensorPackage // 模型Tensor组合数据结构
{
repeated MxpiMetaHeader headerVec = 1;
repeated MxpiTensor tensorVec = 2;
}
message MxpiTensor // 模型Tensor数据结构
{
uint64 tensorDataPtr = 1; // Tensor内存指针
int32 tensorDataSize = 2;
uint32 deviceId = 3;
MxpiMemoryType memType = 4;
uint64 freeFunc = 5; // Tensor内存销毁函数
repeated int32 tensorShape = 6; // Tensor维度
bytes dataStr = 7;
int32 tensorDataType = 8;
}
message MxpiFeatureVectorList // 特征向量列表
{
repeated MxpiFeatureVector featureVec = 1;
}
message MxpiFeatureVector // 特征向量数据结构
{
repeated MxpiMetaHeader headerVec = 1;
repeated float featureValues = 2;
}
message MxpiPoseList // 人体姿态估计数据列表
{
repeated MxpiPose poseVec = 1;
}
message MxpiPose // 人体姿态估计数据信息
{
repeated MxpiMetaHeader headerVec = 1;
repeated MxpiKeyPoint keyPointVec = 2;
float score = 3;
}
message MxpiKeyPoint // 人体关键点数据信息
{
float x = 1;
float y = 2;
int32 name = 3;
float score = 4;
}
message MxpiKeyPointAndAngleList // 关键点和角度信息列表
{
repeated MxpiKeyPointAndAngle keyPointAndAngleVec = 1;
}
message MxpiKeyPointAndAngle
{
repeated MxpiMetaHeader headerVec = 1;
repeated float keyPointsVec = 2; // 目标对应的五个关键点信息
float angleYaw = 3; // 偏航角
float anglePitch = 4; // 俯仰角
float angleRoll = 5; // 横滚角
}
message MxpiTextObjectList // 文本目标数据列表
{
repeated MxpiTextObject objectVec = 1;
}
message MxpiTextObject // 文本目标数据信息。例如文本目标框坐标、置信度、检测文本
{
repeated MxpiMetaHeader headerVec = 1;
float x0 = 2;
float y0 = 3;
float x1 = 4;
float y1 = 5;
float x2 = 6;
float y2 = 7;
float x3 = 8;
float y3 = 9;
float confidence = 10;
string text = 11;
}
message MxpiTextsInfoList // 文本生成数据列表
{
repeated MxpiTextsInfo textsInfoVec = 1;
}
message MxpiTextsInfo // 文本生成数据信息
{
repeated MxpiMetaHeader headerVec = 1;
repeated string text = 2;
}
message MxpiCustomDataList
{
repeated MxpiCustomData dataVec = 1;
}
message MxpiCustomData
{
repeated MxpiMetaHeader headerVec = 1;
map<string, string> map = 2;
}
OSD protobuf 数据结构定义文件(MxpiOSDType.proto)
syntax = "proto3";
package MxTools;
import "MxpiDataType.proto";
message MxpiOsdInstancesList //目标或者分类信息Osd列表
{
repeated MxpiOsdInstances osdInstancesVec = 1;
}
message MxpiOsdInstances //Osd属性描述信息数据结构
{
repeated MxpiMetaHeader headerVec = 1;
repeated MxpiOsdText osdTextVec = 2; //文字描述
repeated MxpiOsdLine osdLineVec = 3; //线条描述
repeated MxpiOsdRect osdRectVec = 4; //矩形框描述
repeated MxpiOsdCircle osdCircleVec = 5; //画圆描述
}
message MxpiOsdText //文字属性数据结构
{
repeated MxpiMetaHeader headerVec = 1;
string text = 2; //要添加的文字内容
int32 x0 = 3; //添加文字原点坐标的X坐标
int32 y0 = 4; //添加文字原点坐标的Y坐标
int32 fontFace = 5; //文字的字体类型
double fontScale = 6; //文字的字体大小
bool bottomLeftOrigin = 7; //取值为true,原点坐标为文字左上角坐标,false为左下角坐标
MxpiOsdParams osdParams = 8; //Osd公有属性实例对象
bool fixedArea = 9; //缩放后,Osd属性描述信息是否按照原图等比例缩放
}
message MxpiOsdLine //线条属性数据结构
{
repeated MxpiMetaHeader headerVec = 1;
int32 x0 = 2; //线条左上角X坐标
int32 y0 = 3; //线条左上角Y坐标
int32 x1 = 4; //线条右下角X坐标
int32 y1 = 5; //线条右下角Y坐标
MxpiOsdParams osdParams = 6; //Osd公有属性实例对象
}
message MxpiOsdRect //矩形框属性数据结构
{
repeated MxpiMetaHeader headerVec = 1;
int32 x0 = 2; //矩形框左上角X坐标
int32 y0 = 3; //矩形框左上角Y坐标
int32 x1 = 4; //矩形框右下角X坐标
int32 y1 = 5; //矩形框右下角Y坐标
MxpiOsdParams osdParams = 6; //Osd公有属性实例对象
bool fixedArea = 7; //缩放后,Osd属性描述信息是否按照原图等比例缩放
}
message MxpiOsdCircle //画圆属性数据结构
{
repeated MxpiMetaHeader headerVec = 1;
int32 x0 = 2; //画圆左上角X坐标
int32 y0 = 3; //画圆左上角Y坐标
int32 radius = 4; //画圆的半径
MxpiOsdParams osdParams = 5; //Osd公有属性实例对象
}
message MxpiOsdParams //Osd公有属性数据结构
{
uint32 scalorB = 1; //颜色B通道值,取值范围0-255
uint32 scalorG = 2; //颜色G通道值,取值范围0-255
uint32 scalorR = 3; //颜色R通道值,取值范围0-255
int32 thickness = 4; //粗细大小
int32 lineType = 5; //线条类型
int32 shift = 6; //缩放参数
}
父主题: 文件示例