forked from Jeffwhen/tpu-perf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblob.proto
131 lines (113 loc) · 3.73 KB
/
blob.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
syntax = "proto2";
package ufw;
message BlobShape {
repeated int64 dim = 1 [packed = true];
}
message BlobPerChannelInfo {
optional string name = 1;
repeated int64 channels = 2;
repeated float threshold = 3;
}
message BlobProto {
optional BlobShape shape = 7;
repeated float data = 5 [packed = true];
repeated float diff = 6 [packed = true];
repeated double double_data = 8 [packed = true];
repeated double double_diff = 9 [packed = true];
//used for int8 coeff mode: only coeff convert to int8, while neuron calculation is still float
optional bytes int8_data = 10;
optional bytes int8_diff = 11;
optional float fscale_int8_to_float = 13 [default = 1];
//used for int8 neuron mode: coeff and neuron calculation are both int8
repeated sint32 int32_data = 14[packed = true];
repeated sint32 int32_diff = 15[packed = true];
optional sint32 right_shift_num = 16 [default = 0xff];
optional float scaleToFloat = 23 [default = 1];
repeated float scaleToFloatPerChannel = 24 [packed = true];
optional bool per_channel_en = 25 [default = false];
enum bitWidthMode {
bitWidth_8 = 0;
bitWidth_16 = 1;
bitWidth_32 = 2;
}
enum FixedSignType {
UNSIGNED = 0;
SIGNED = 1;
}
enum Dtype {
FP32 = 0;
FP16 = 1;
INT8 = 2;
UINT8 = 3;
INT16 = 4;
UINT16 = 5;
INT32 = 6;
UINT32 = 7;
}
//weight use 8 bit quantization, bias use 16 bit quantization
optional bitWidthMode bit_width = 17[default = bitWidth_8];
//weight use 8 bit quantization, bias use 16 bit quantization
optional int32 factor_inverse_full_scale = 18[default = 127];
repeated sint32 winograd_data_fixpoint = 19;
optional sint32 winograd_right_shift_num = 20 [default = 0xff];
optional FixedSignType fixed_sign_type = 21[default = SIGNED];
optional Dtype dtype = 22 [default = FP32];
// 4D dimensions -- deprecated. Use "shape" instead.
optional int32 num = 1 [default = 0];
optional int32 channels = 2 [default = 0];
optional int32 height = 3 [default = 0];
optional int32 width = 4 [default = 0];
}
// The BlobProtoVector is simply a way to pass multiple blobproto instances
// around.
message BlobProtoVector {
repeated BlobProto blobs = 1;
}
message Datum {
optional BlobShape shape = 8;
optional int32 channels = 1;
optional int32 height = 2;
optional int32 width = 3;
// the actual image data, in bytes
optional bytes data = 4;
optional int32 label = 5;
// Optionally, the datum could also hold float data.
repeated float float_data = 6;
// If true data contains an encoded image that need to be decoded
optional bool encoded = 7 [default = false];
optional BlobProto.Dtype dtype = 9 [default = UINT8];
}
// 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;
}