diff --git a/.gitignore b/.gitignore index b33e012d38b866473a6e81cb3f3e6d370d6787cd..e94becb2a485ef24b1db05db2c82080803e34112 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,13 @@ dataset.txt *.pdmodel *.onnx *.rknn +debug* +*.ncnn.bin +*.ncnn.param +*.pnnx.bin +*.pnnx.param +LZ-*.py + # Picture *.jpg diff --git a/configs/LZ-ArcFace.yaml b/configs/LZ-ArcFace.yaml index 789cdb1a296a6966c9ecb6195cf9efbb463ef734..a1bdec9575bc6bb564ad0843c02ccfc4241505b7 100644 --- a/configs/LZ-ArcFace.yaml +++ b/configs/LZ-ArcFace.yaml @@ -1,15 +1,3 @@ -config: - # RGB - mean: - - 0.485 - - 0.456 - - 0.406 - std: - - 0.229 - - 0.224 - - 0.225 - type: "fp32" - load_onnx: inputs: - x @@ -22,6 +10,18 @@ load_onnx: outputs: - save_infer_model/scale_0.tmp_1 +config: + # RGB + mean: + - 0.485 + - 0.456 + - 0.406 + std: + - 0.229 + - 0.224 + - 0.225 + type: "fp32" + build: do_quantization: True dataset: ./dataset.txt \ No newline at end of file diff --git a/configs/LZ-LPRNet.yaml b/configs/LZ-LPRNet.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5a4a9544c5e4b147cc40d7c8bccea33e87dfbfb1 --- /dev/null +++ b/configs/LZ-LPRNet.yaml @@ -0,0 +1,27 @@ +load_onnx: + inputs: + - input + input_size_list: + - + - 1 + - 3 + - 24 + - 94 + outputs: + - output + +config: + # RGB + mean: + - 0.5 + - 0.5 + - 0.5 + std: + - 0.5 + - 0.5 + - 0.5 + type: "fp32" + +build: + do_quantization: True + dataset: ./dataset.txt \ No newline at end of file diff --git a/configs/LZ-MobileNetV3.yaml b/configs/LZ-MobileNetV3.yaml index 3020477267defa7a24aaf04d9fdda63c41c3ac6e..563dca53f9fc80c702632d6db6e4f9b92966c62a 100644 --- a/configs/LZ-MobileNetV3.yaml +++ b/configs/LZ-MobileNetV3.yaml @@ -1,15 +1,3 @@ -config: - # BGR - mean: - - 0.406 - - 0.456 - - 0.485 - std: - - 0.225 - - 0.224 - - 0.229 - type: "fp32" - load_onnx: inputs: - x @@ -22,6 +10,18 @@ load_onnx: outputs: - DequantizeLinear.881 +config: + # BGR + mean: + - 0.406 + - 0.456 + - 0.485 + std: + - 0.225 + - 0.224 + - 0.229 + type: "fp32" + build: do_quantization: false dataset: \ No newline at end of file diff --git a/configs/LZ-Picodet.yaml b/configs/LZ-Picodet.yaml index ce39f0e08cd8525bcef3bd1af694ff78e2a37261..e7ac15fb80d0426d2a07dd15dc5995c705f4fdd2 100644 --- a/configs/LZ-Picodet.yaml +++ b/configs/LZ-Picodet.yaml @@ -1,15 +1,3 @@ -config: - # BGR - mean: - - 0.406 - - 0.456 - - 0.485 - std: - - 0.225 - - 0.224 - - 0.229 - type: "fp32" - load_onnx: inputs: - image @@ -29,6 +17,18 @@ load_onnx: - DequantizeLinear.1445 - DequantizeLinear.1447 +config: + # BGR + mean: + - 0.406 + - 0.456 + - 0.485 + std: + - 0.225 + - 0.224 + - 0.229 + type: "fp32" + build: do_quantization: false dataset: \ No newline at end of file diff --git a/configs/LZ-Picodet_fp32.yaml b/configs/LZ-Picodet_fp32.yaml index 8071fd36f468de700f4ff2c7cebc90e887ddc9b7..4cd21d4f7e85fac47067bbd44dd238e9f1fcff8d 100644 --- a/configs/LZ-Picodet_fp32.yaml +++ b/configs/LZ-Picodet_fp32.yaml @@ -1,15 +1,3 @@ -config: - # BGR - mean: - - 0.406 - - 0.456 - - 0.485 - std: - - 0.225 - - 0.224 - - 0.229 - type: "fp32" - load_onnx: inputs: - image @@ -29,6 +17,18 @@ load_onnx: - sigmoid_3.tmp_0 - split_3.tmp_1 +config: + # BGR + mean: + - 0.406 + - 0.456 + - 0.485 + std: + - 0.225 + - 0.224 + - 0.229 + type: "fp32" + build: do_quantization: True dataset: ./dataset.txt \ No newline at end of file diff --git a/configs/LZ-RetinaFace.yaml b/configs/LZ-RetinaFace.yaml index e51314cc0e35676f65f8b1635a1c2a0d3612a7bd..e8b9a23754229e5806849e481fedf5742fb13fc6 100644 --- a/configs/LZ-RetinaFace.yaml +++ b/configs/LZ-RetinaFace.yaml @@ -1,15 +1,3 @@ -config: - # RGB - mean: - - -104 - - -117 - - -123 - std: - - 1 - - 1 - - 1 - type: "int8" - load_onnx: inputs: - input0 @@ -24,6 +12,18 @@ load_onnx: - classifications - 571 +config: + # RGB + mean: + - -104 + - -117 + - -123 + std: + - 1 + - 1 + - 1 + type: "int8" + build: do_quantization: True dataset: ./dataset.txt \ No newline at end of file diff --git a/docs/models/lprnet.md b/docs/models/lprnet.md new file mode 100644 index 0000000000000000000000000000000000000000..6b424881cee156094ed14a80e15d7bdc12c16838 --- /dev/null +++ b/docs/models/lprnet.md @@ -0,0 +1,23 @@ +```bash +cd /path/to/LockzhinerVisionModule + +rm lprnet.onnx +wget https://ftrg.zbox.filez.com/v2/delivery/data/95f00b0fc900458ba134f8b180b3f7a1/examples/LPRNet/lprnet.onnx + +rm LZ-LPRNet.onnx +mv lprnet.onnx LZ-LPRNet.onnx + +export EXPORT_MODEL_NAME=LZ-LPRNet +mkdir -p ${EXPORT_MODEL_NAME} +pnnx ${EXPORT_MODEL_NAME}.onnx \ + pnnxparam=${EXPORT_MODEL_NAME}/${EXPORT_MODEL_NAME}.pnnx.param \ + pnnxbin=${EXPORT_MODEL_NAME}/${EXPORT_MODEL_NAME}.pnnx.bin \ + pnnxpy=${EXPORT_MODEL_NAME}/${EXPORT_MODEL_NAME}.py \ + pnnxonnx=${EXPORT_MODEL_NAME}/${EXPORT_MODEL_NAME}.pnnx.onnx \ + ncnnparam=${EXPORT_MODEL_NAME}/${EXPORT_MODEL_NAME}.ncnn.param \ + ncnnbin=${EXPORT_MODEL_NAME}/${EXPORT_MODEL_NAME}.ncnn.bin \ + ncnnpy=${EXPORT_MODEL_NAME}/${EXPORT_MODEL_NAME}.py \ + inputshape=[1,3,24,94] + +zip -r -9 ${EXPORT_MODEL_NAME}.zip ${EXPORT_MODEL_NAME} +``` \ No newline at end of file diff --git a/example/vision/classification/README.md b/example/vision/classification/README.md index 34a794a6e14ef616d5483d7c8b738f59e11bf09e..554f0196675cec22469a2cedae0c7eb11ee9bde3 100644 --- a/example/vision/classification/README.md +++ b/example/vision/classification/README.md @@ -51,7 +51,7 @@ Labelme 是一个 python 语言编写,带有图形界面的图像标注软件 ### 2.2 标注前的准备 -首先,请参考 [摄像头使用指南](./example/periphery/capture) 利用 **Lockzhiner Vision Module 图片获取助手** 拍摄你需要进行标注的图片,如下图所示: +首先,请参考 [摄像头使用指南](../../periphery/capture) 利用 **Lockzhiner Vision Module 图片获取助手** 拍摄你需要进行标注的图片,如下图所示: ![](images/capture_images.png) diff --git a/example/vision/detetcion/README.md b/example/vision/detetcion/README.md index d2c2a4c2affbe18488756996322338378ef61671..db16b50a8eae776d24b3777d789a89fd7820e578 100644 --- a/example/vision/detetcion/README.md +++ b/example/vision/detetcion/README.md @@ -53,7 +53,7 @@ Labelme 是一个 python 语言编写,带有图形界面的图像标注软件 ### 2.2 标注前的准备 -首先,请参考 [摄像头使用指南](./example/periphery/capture) 利用 **Lockzhiner Vision Module 图片获取助手** 拍摄你需要进行标注的图片,如下图所示: +首先,请参考 [摄像头使用指南](../../periphery/capture) 利用 **Lockzhiner Vision Module 图片获取助手** 拍摄你需要进行标注的图片,如下图所示: ![](images/capture_images.png) diff --git a/utils/export.py b/utils/export.py index c826f0912d36301f82a6e96d742c4764902b6df0..c990f0f9b169247f5ea5360a323e8ae676eaeb69 100644 --- a/utils/export.py +++ b/utils/export.py @@ -9,20 +9,14 @@ import onnx def get_config(): parser = argparse.ArgumentParser() parser.add_argument("--verbose", default="Debug", help="rknntoolkit verbose") - parser.add_argument( - "--config_path", required=True, help="The path of model config file" - ) - parser.add_argument( - "--model_load_path", required=True, help="The path of onnx model file" - ) - parser.add_argument("--target_platform", required=True, help="The target platform") - parser.add_argument( - "--model_save_path", required=True, help="The path of rknn model save" + parser.add_argument("--config_path", required=True, help="The path of model config file") + parser.add_argument("--model_load_path", required=True, help="The path of onnx model file") + parser.add_argument("--target_platform", required=False, help="The target platform") + parser.add_argument("--model_save_path", required=False, help="The path of rknn model save" ) args = parser.parse_args() return args - if __name__ == "__main__": config = get_config() with open(config.config_path) as file: @@ -30,9 +24,13 @@ if __name__ == "__main__": yaml_config = yaml.safe_load(file_data) print(yaml_config) - config_inputs = [str(input_name) for input_name in yaml_config["load_onnx"]["inputs"]] + config_inputs = [ + str(input_name) for input_name in yaml_config["load_onnx"]["inputs"] + ] config_input_size_list = yaml_config["load_onnx"]["input_size_list"] - config_outputs = [str(output_name) for output_name in yaml_config["load_onnx"]["outputs"]] + config_outputs = [ + str(output_name) for output_name in yaml_config["load_onnx"]["outputs"] + ] # Prune ONNX Model print("--> Prune ONNX Model") @@ -98,4 +96,4 @@ if __name__ == "__main__": model_save_path = config.model_save_path ret = model.export_rknn(model_save_path) assert ret == 0, "Export rknn model failed!" - print("Export OK!") + print("Export OK!") \ No newline at end of file