diff --git a/README.md b/README.md index 504eb8b..f5bf328 100644 --- a/README.md +++ b/README.md @@ -33,28 +33,28 @@ $ pip install -U onnx \ https://github.com/PINTO0309/simple-onnx-processing-tools#docker ## 2. CLI Usage -```bash +``` $ scc4onnx -h usage: scc4onnx [-h] - --input_onnx_file_path INPUT_ONNX_FILE_PATH - --output_onnx_file_path OUTPUT_ONNX_FILE_PATH - [--input_op_names_and_order_dims INPUT_OP_NAME ORDER_DIM] - [--channel_change_inputs INPUT_OP_NAME DIM] - [--non_verbose] + -if INPUT_ONNX_FILE_PATH + -of OUTPUT_ONNX_FILE_PATH + [-ioo INPUT_OP_NAME ORDER_DIM] + [-cci INPUT_OP_NAME DIM] + [-n] optional arguments: -h, --help show this help message and exit - --input_onnx_file_path INPUT_ONNX_FILE_PATH + -if INPUT_ONNX_FILE_PATH, --input_onnx_file_path INPUT_ONNX_FILE_PATH Input onnx file path. - --output_onnx_file_path OUTPUT_ONNX_FILE_PATH + -of OUTPUT_ONNX_FILE_PATH, --output_onnx_file_path OUTPUT_ONNX_FILE_PATH Output onnx file path. - --input_op_names_and_order_dims INPUT_OP_NAME ORDER_DIM + -ioo INPUT_OP_NAMES_AND_ORDER_DIMS INPUT_OP_NAMES_AND_ORDER_DIMS, --input_op_names_and_order_dims INPUT_OP_NAMES_AND_ORDER_DIMS INPUT_OP_NAMES_AND_ORDER_DIMS Specify the name of the input_op to be dimensionally changed and the order of the dimensions after the change. The name of the input_op to be dimensionally changed can be specified multiple times. @@ -64,7 +64,7 @@ optional arguments: --input_op_names_and_order_dims bbb [0,2,3,1] \ --input_op_names_and_order_dims ccc [0,3,1,2,4,5] - --channel_change_inputs INPUT_OP_NAME DIM + -cci CHANNEL_CHANGE_INPUTS CHANNEL_CHANGE_INPUTS, --channel_change_inputs CHANNEL_CHANGE_INPUTS CHANNEL_CHANGE_INPUTS Change the channel order of RGB and BGR. If the original model is RGB, it is transposed to BGR. If the original model is BGR, it is transposed to RGB. @@ -83,7 +83,7 @@ optional arguments: --channel_change_inputs bbb 1 \ --channel_change_inputs ccc 5 - --non_verbose + -n, --non_verbose Do not show all information logs. Only error logs are displayed. ``` @@ -108,29 +108,29 @@ order_conversion( input_onnx_file_path: Optional[str] Input onnx file path. Either input_onnx_file_path or onnx_graph must be specified. - + output_onnx_file_path: Optional[str] Output onnx file path. If output_onnx_file_path is not specified, no .onnx file is output. - + onnx_graph: Optional[onnx.ModelProto] onnx.ModelProto. Either input_onnx_file_path or onnx_graph must be specified. onnx_graph If specified, ignore input_onnx_file_path and process onnx_graph. - + input_op_names_and_order_dims: Optional[dict] Specify the name of the input_op to be dimensionally changed and the order of the dimensions after the change. The name of the input_op to be dimensionally changed can be specified multiple times. - + e.g. input_op_names_and_order_dims = { "input_op_name1": [0,3,1,2], "input_op_name2": [0,2,3,1], "input_op_name3": [0,3,1,2,4,5], } - + channel_change_inputs: Optional[dict] Change the channel order of RGB and BGR. If the original model is RGB, it is transposed to BGR. @@ -144,18 +144,18 @@ order_conversion( dimension_number_representing_the_channel must specify the dimension position after the change in input_op_names_and_order_dims. For example, dimension_number_representing_the_channel is 1 for NCHW and 3 for NHWC. - + e.g. channel_change_inputs = { "aaa": 1, "bbb": 3, "ccc": 2, } - + non_verbose: Optional[bool] Do not show all information logs. Only error logs are displayed. Default: False - + Returns ------- order_converted_graph: onnx.ModelProto diff --git a/scc4onnx/__init__.py b/scc4onnx/__init__.py index 94dc522..09ee900 100644 --- a/scc4onnx/__init__.py +++ b/scc4onnx/__init__.py @@ -1,3 +1,3 @@ from scc4onnx.onnx_input_order_converter import order_conversion, main -__version__ = '1.0.4' +__version__ = '1.0.5' diff --git a/scc4onnx/onnx_input_order_converter.py b/scc4onnx/onnx_input_order_converter.py index 4b08396..8614896 100644 --- a/scc4onnx/onnx_input_order_converter.py +++ b/scc4onnx/onnx_input_order_converter.py @@ -427,18 +427,21 @@ def order_conversion( def main(): parser = ArgumentParser() parser.add_argument( + '-if', '--input_onnx_file_path', type=str, required=True, help='Input onnx file path.' ) parser.add_argument( + '-of', '--output_onnx_file_path', type=str, required=True, help='Output onnx file path.' ) parser.add_argument( + '-ioo', '--input_op_names_and_order_dims', nargs=2, action='append', @@ -453,6 +456,7 @@ def main(): '--input_op_names_and_order_dims ccc [0,3,1,2,4,5]' ) parser.add_argument( + '-cci', '--channel_change_inputs', nargs=2, action='append', @@ -475,6 +479,7 @@ def main(): '--channel_change_inputs ccc 5' ) parser.add_argument( + '-n', '--non_verbose', action='store_true', help='Do not show all information logs. Only error logs are displayed.'