这篇博客讲解的非常好,我这里只是搬运和总结
先看一张图,完美解释了AnnotationDatum的数据结构。
um的数据结,SSD读取数据,需要将label和图片封装到一个数据结构下,这时候老版本caffe的Datum数据结构不够用了
我们来看看caffe-ssd的 AnnotatedDatum数据
先看 caffe.proto文件(protubuf,不懂的得先了解一下protobuf)
// The normalized bounding box [0, 1] w.r.t. the input image size.
message NormalizedBBox {
optional float xmin = 1;
optional float ymin = 2;
optional float xmax = 3;
optional float ymax = 4;
optional int32 label = 5;
optional bool difficult = 6;
optional float score = 7;
optional float size = 8;
}
// Annotation for each object instance.
message Annotation {
optional int32 instance_id = 1 [default = 0];
optional NormalizedBBox bbox = 2;
}
// Group of annotations for a particular label.
message AnnotationGroup {
optional int32 group_label = 1;
repeated Annotation annotation = 2;
}
// An extension of Datum which contains "rich" annotations.
message AnnotatedDatum {
enum AnnotationType {
BBOX = 0;
}
optional Datum datum = 1;
// If there are "rich" annotations, specify the type of annotation.
// Currently it only supports bounding box.
// If there are no "rich" annotations, use label in datum instead.
optional AnnotationType type = 2;
// Each group contains annotation for a particular class.
repeated AnnotationGroup annotation_group = 3;
}
我们可以看到,AnnotationDatum下包含AnnotationType、Datum和AnnotationGroup三个结构
其中Datum结构用于存放图片信息,和老版本caffe的Datum是一样的,.
AnnotationGroup里面包含grouplabel和Annotation结构
Annotation结构里又包含 instance_id和NormalizedBBox结构