Problem:
One solution that came up:
Let's talk about this...
An example
one-import tf -c detectimage.cfg
where there is detectimage.pb file as an input model
To be added
one-compile.config# This configuration file is used to configure the parameters and initial settings for ONE command driver.
# input_path Path to input model
input_path=""
# output_path Path to output model
output_path=""
### one-import-tf ### one-import-bcq ###
# input_arrays Names of the input arrays, comma-separated
input_arrays=""
# input_shapes Input shapes, colon-separated
input_shapes=""
# output_arrays Names of the output arrays, comma-separated
output_arrays=""
# v2 Use TensorFlow 2.x interface (default is 1.x interface)
v2="false"
### one-import-tflite ###
### one-optimize ###
# all Enable all optimization algorithms
all="true"
# fuse_bcq Enable FuseBCQ Pass
fuse_bcq="false"
# fuse_instnorm Enable FuseInstanceNormalization Pass
fuse_instnorm="false"
# resolve_customop_add Enable ResolveCustomOpAddPass Pass
resolve_customop_add="false"
# resolve_customop_batchmatmul Enable ResolveCustomOpBatchMatMulPass Pass
resolve_customop_batchmatmul="false"
# resolve_customop_matmul Enable ResolveCustomOpMatMulPass Pass
resolve_customop_matmul="false"
### one-quantize ###
# input_dtype Input data type (supported: float32, default=float32)
input_dtype=""
# quantized_dtype Output quantized data type (supported: uint8, default=uint8)
quantized_dtype=""
# granularity Quantize granularity (supported: layer, channel, default=layer)
granularity=""
# min_percentile Minimum percentile (0.0~100.0, default=1.0)
min_percentile=""
# max_percentile Maximum percentile (0.0~100.0, default=99.0)
max_percentile=""
# mode Record mode (supported: percentile/moving_average, default=percentile)
mode=""
# input_data Path to input data
input_data=""
### one-pack ###
# nnpackage_path Path to nnpackage folder
nnpackage_path=""
### one-codegen ###
# BACKEND dirvers
#backend_drivers="driver1;driver2;..."
If we use one-compile.config file for all one-cmds, each input path and output path may be different.
For this, @lemmaa suggested using section, something like this;
[import]
input_path="..."
output_path="..."
[optimize]
input_path="..."
output_path="..."
[quantize]
input_path="..."
output_path="..."
...
FYI, various INI parsers by googling. Didn't checked in detail. :)
@seanshpark @lemmaa
Both of comments sound good for me.
FYI, I had considered the things you pointed before posting above my comment. Here is what I thought of them.
each input path and output path may be different
I thought most of users want to just run all the ONE drivers at once. This is a consideration of whether the user cares about "each" driver's input and output. If the user wants the output of a specific driver, they can either modify input in the config file or override the input directly from the command line. Also, by the way, latter looks too verbose.
Actually, my suggestion came out for convenience of implementation. I just wanted to source the config file, which makes it easy to write a one-compile bash script. Moreover, in the former case, we have to create a parser in any language or have a dependency on a specific library.
only one input and output path or each
If we provide only one input and one output, I think there will be no problem if intermediate paths can be generated and avoid conflicts.
Also, FYI, here is how above suggestion came out.
one-cmds driver in one place.input_path and output_path.(one-import-tflite and one-codegen section got notthing because they only need input and output)
One thing to consider here is whether or not to combine the nnpackage_path of one-pack into the output_path. Here is what I thought.
$ cat one-compile.config
...
output_path="inception_v3.circle"
...
nnpackage_path="nnpack"
...
The result would be
└── nnpack # -> `nnpackage_path`
└── inception_v3
├── inception_v3.circle # -> `output_path`
└── metadata
└── MANIFEST
It may be handy if a user could load configuration from a file first, and then override its parameter via command line
$ one-import tf -c detectimage.cfg --output-arrays "..."
(ADDED) It is sometimes useful to compose multiple configurations ;-)
$ one-import tf -c input.cfg -c for_detection.cfg
$ one-import tf -c input.cfg -c for_feature_extraction.cfg
FYI, various INI parsers by googling. Didn't checked in detail. :)
* C++: https://github.com/mcmtroffaes/inipp * Python : https://docs.python.org/3/library/configparser.html * Bash: https://github.com/albfan/bash-ini-parser * ...
YAML/TOML fit well for this purpose IMHO.
To support input/output types for use cases
/cc @Samsung/sdk
/cc @Samsung/sdk
@winstone77
Then can it be summarized as follow?
.cfg file is okay. Thus MDK will try to create default config file for MDK and related UI after consulting with NNCompress.the modified option can be passed as an argument, is it possible to handle override?
@mhs4670go Can we implement to enable overriding options?
Can I know when to receive the integrated driver roughly?
@seanshpark Can you answer for this question?
@seanshpark Can you answer for this question?
This too will be answered by @mhs4670go :)
https://github.com/Samsung/ONE/issues/4278#issuecomment-693758144
I thought most of users want to just run all the ONE drivers at once. ...
@mhs4670go , Yes, most, not all.
We are not discussing this to support a single representative scenario. MDK's requirements are just one of the many scenarios we have to do. Therefore, we expect to be able to handle the input and output at the beginning and end, as well as at various parts in the middle of chains, in the configuration file.
close?