Input Files to the DMP tool - DigitalMediaProfessionals/dv-sdk GitHub Wiki
Configuration File
The entire network conversion process is affected by its input .ini file. Here the .ini file of CaffeMobileNet is shown as an example, and the descriptions of each field is given.
[INPUT]
name = CaffeMobileNet
definition = mobilenet_deploy.prototxt
data = mobilenet.caffemodel
origin = CAFFE
[OUTPUT]
output_folder = ../ ;Output folder root. Actual output is in output_folder/name
generate_source = 1 ;If set to 1, generate the .cpp and .h class for the network
generate_doxy = 1 ;If set to 1, generate the doxygen documentation for the generate code
generate_dot = 1 ;If set to 1, add the resulting network graph to documentation using dot format
[OPTIONAL]
verbose = 1 ; ; Disable/Enable output to the console when the network convertor is working
graphviz_path = C:/graphviz-2.38/release/bin ; Path to graphwiz executable for generating graph. Must be set if generate_dot is set to 1
INPUT
Field | Description |
---|---|
origin | Specify from which API the network was exported (Caffe or Keras). |
name | Name of the network (if needed, can be different from the names defined in the hdf5/prototxt file). |
definition | File name containing the network definition, may be a hdf5 or a prototxt file. |
data | File name containing the network weights. For Caffe networks can be .caffemodel or .protobuf files. Can be omitted for Keras networks since it put network definition and weights in the same file. |
custom_layer | If provided, refers to a Python script that provides definition of customlayers for the network convertor to parse. See Custom Layer for details about how to support custom layers. |
width_override | If both width_override and height_override are provided, will override the input dimension setting of the network. |
height_override | See above. |
OUTPUT
Field | Default | Description |
---|---|---|
output_folder | Specify the output folder where all the files will be stored. A relative path is relative to a directory where this INI file eixsts. | |
generate_source | 0 | If set to 1, generate the .cpp and .h files for the network configuration, to be compiled later. |
generate_doxy | 0 | If set to 1, generate the doxygen configuration. |
generate_dot | 0 | If set to 1, generate the dot file of the network. |
quantization | 1 | If set to 1, the weight generated will be quantized. |
transpose_weight | 1 | If set to 1, the input/output of the model don't need to be transposed but the weight will be transposed instead. See Network input output layout for details. |
python_module | Specify the Python wrapper module name. When this field is not given, the network convertor does not generate the source code for the Python wrapper. |
If quantization is set to 1, the network convertor (referred to as the convertor) will compress the weights by using K-means to calculate 255 closes numbers, and each weight is replaced to an index to one of these numbers. This is to save memory bandwidths in runtime; in exchange of the inference quality. If this is not the desired behavior, one should disable this option, then the convertor will only convert the weights to 16-bits floating points numbers.
The output folder will be actually defined as output_folder\name, where name is defined in the Input section of the .ini file.
Similarly, Documentation will be generated in the folder output_folder\name\doc. Dot is a standard file format for defining graphs. One may want to refer to Dot-Wikipedia for more details. Note that it is important to set and install graphviz in order to view the dot files in the documentation. Path to graphviz can be specified in the Optional section.
OPTIONAL
Field | Description |
---|---|
verbose | If set to 1, the convertor will output additional information to the console. |
graphviz_path | Path to graphwiz executable |
Exporting Network from DL Framework
This section describes how to export your network from several Deep Learning frameworks for the convertor.
Keras
Please save your network in a HDF5 file by model.save()
as described in Officail FAQ.
Caffe
.prototxt
file
Prepare a .prototxt
that you used with Caffe for defining a network.
.caffemodel
file
Pass the convertor a .caffemodel
file generated by command caffe train
with snapshot_format: BINARYPROTO
configuration.
If you used Caffe in Python or Matlab, call net.save()
to export a .caffemodel
file.