| 1 | ## net.param |
| 2 | ### example |
| 3 | ``` |
| 4 | 7767517 |
| 5 | 3 3 |
| 6 | Input input 0 1 data 0=4 1=4 2=1 |
| 7 | InnerProduct ip 1 1 data fc 0=10 1=1 2=80 |
| 8 | Softmax softmax 1 1 fc prob 0=0 |
| 9 | ``` |
| 10 | ### overview |
| 11 | ``` |
| 12 | [magic] |
| 13 | ``` |
| 14 | * magic number : 7767517 |
| 15 | ``` |
| 16 | [layer count] [blob count] |
| 17 | ``` |
| 18 | * layer count : count of the layer line follows, should be exactly the count of all layer names |
| 19 | * blob count : count of all blobs, usually greater than or equals to the layer count |
| 20 | ### layer line |
| 21 | ``` |
| 22 | [layer type] [layer name] [input count] [output count] [input blobs] [output blobs] [layer specific params] |
| 23 | ``` |
| 24 | * layer type : type name, such as Convolution Softmax etc |
| 25 | * layer name : name of this layer, must be unique among all layer names |
| 26 | * input count : count of the blobs this layer needs as input |
| 27 | * output count : count of the blobs this layer produces as output |
| 28 | * input blobs : name list of all the input blob names, separated by space, must be unique among input blob names of all layers |
| 29 | * output blobs : name list of all the output blob names, separated by space, must be unique among output blob names of all layers |
| 30 | * layer specific params : key=value pair list, separated by space |
| 31 | ### layer param |
| 32 | ``` |
| 33 | 0=1 1=2.5 -23303=2,2.0,3.0 |
| 34 | ``` |
| 35 | key index should be unique in each layer line, pair can be omitted if the default value used |
| 36 | |
| 37 | the meaning of existing param key index can be looked up at [operation-param-weight-table](operation-param-weight-table) |
| 38 | |
| 39 | * integer or float key : index 0 ~ 19 |
| 40 | * integer value : int |
| 41 | * float value : float |
| 42 | * integer array or float array key : -23300 minus index 0 ~ 19 |
| 43 | * integer array value : [array size],int,int,...,int |
| 44 | * float array value : [array size],float,float,...,float |
| 45 | |
| 46 | ## net.bin |
| 47 | ``` |
| 48 | +---------+---------+---------+---------+---------+---------+ |
| 49 | | weight1 | weight2 | weight3 | weight4 | ....... | weightN | |
| 50 | +---------+---------+---------+---------+---------+---------+ |
| 51 | ^ ^ ^ ^ |
| 52 | 0x0 0x80 0x140 0x1C0 |
| 53 | ``` |
| 54 | the model binary is the concatenation of all weight data, each weight buffer is aligned by 32bit |
| 55 | |
| 56 | ### weight buffer |
| 57 | ``` |
| 58 | [flag] (optional) |
| 59 | [raw data] |
| 60 | [padding] (optional) |
| 61 | ``` |
| 62 | * flag : unsigned int, little-endian, indicating the weight storage type, 0 => float32, 0x01306B47 => float16, otherwise => quantized int8, may be omitted if the layer implementation forced the storage type explicitly |
| 63 | * raw data : raw weight data, little-endian, float32 data or float16 data or quantized table and indexes depending on the storage type flag |
| 64 | * padding : padding space for 32bit alignment, may be omitted if already aligned |