diff --git a/README.md b/README.md index 7b1f6a49..f2ede89e 100644 --- a/README.md +++ b/README.md @@ -2211,7 +2211,7 @@ The following table describes the most important command line arguments for `ai8 | `--no-unload` | Do not create the `cnn_unload()` function | | | `--no-kat` | Do not generate the `check_output()` function (disable known-answer test) | | | `--no-deduplicate-weights` | Do not deduplicate weights and and bias values | | -| `--scale-output` | Use scales from the checkpoint to recover output range while generating `cnn_unload()` function | | +| `--no-scale-output` | Do not use scales from the checkpoint to recover output range while generating `cnn_unload()` function | | ### YAML Network Description @@ -2333,7 +2333,7 @@ The following keywords are required for each `unload` list item: `width`: Data width (optional, defaults to 8) — either 8 or 32 `write_gap`: Gap between data words (optional, defaults to 0) -When `--scale-output` is specified, scales from the checkpoint file are used to recover the output range. If there is a non-zero scale for the 8 bits output, the output will be scaled and kept in 16 bits. If the scale is zero, the output will be 8 bits. For 32 bits output, the output will be kept in 32 bits always. +When `--no-scale-output` is not specified, scales from the checkpoint file are used to recover the output range. If there is a non-zero scale for the 8 bits output, the output will be scaled and kept in 16 bits. If the scale is zero, the output will be 8 bits. For 32 bits output, the output will be kept in 32 bits always. Example: diff --git a/README.pdf b/README.pdf index ad4d21e1..b426a1f1 100644 Binary files a/README.pdf and b/README.pdf differ diff --git a/gen-demos-max78000.sh b/gen-demos-max78000.sh index 53f82f72..737dfd6f 100755 --- a/gen-demos-max78000.sh +++ b/gen-demos-max78000.sh @@ -15,7 +15,9 @@ python ai8xize.py --test-dir $TARGET --prefix kws20_nas --checkpoint-file traine python izer/add_fake_passthrough.py --input-checkpoint-path trained/ai85-faceid_112-qat-q.pth.tar --output-checkpoint-path trained/ai85-fakepass-faceid_112-qat-q.pth.tar --layer-name fakepass --layer-depth 128 --layer-name-after-pt linear --low-memory-footprint "$@" python ai8xize.py --test-dir $TARGET --prefix faceid_112 --checkpoint-file trained/ai85-fakepass-faceid_112-qat-q.pth.tar --config-file networks/ai85-faceid_112.yaml --fifo $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix cats-dogs --checkpoint-file trained/ai85-catsdogs-qat8-q.pth.tar --config-file networks/cats-dogs-hwc.yaml --fifo --softmax $COMMON_ARGS "$@" +python izer/add_fake_passthrough.py --input-checkpoint-path trained/ai85-camvid-unet-large-q.pth.tar --output-checkpoint-path trained/ai85-camvid-unet-large-fakept-q.pth.tar --layer-name pt --layer-depth 56 --layer-name-after-pt upconv3 "$@" python ai8xize.py --test-dir $TARGET --prefix camvid_unet --checkpoint-file trained/ai85-camvid-unet-large-fakept-q.pth.tar --config-file networks/camvid-unet-large-fakept.yaml $COMMON_ARGS --overlap-data --mlator --no-unload --max-checklines 8192 --new-kernel-loader "$@" +python izer/add_fake_passthrough.py --input-checkpoint-path trained/ai85-aisegment-unet-large-q.pth.tar --output-checkpoint-path trained/ai85-aisegment-unet-large-fakept-q.pth.tar --layer-name pt --layer-depth 56 --layer-name-after-pt upconv3 "$@" python ai8xize.py --test-dir $TARGET --prefix aisegment_unet --checkpoint-file trained/ai85-aisegment-unet-large-fakept-q.pth.tar --config-file networks/aisegment-unet-large-fakept.yaml $COMMON_ARGS --overlap-data --mlator --no-unload --max-checklines 8192 --new-kernel-loader "$@" python ai8xize.py --test-dir $TARGET --prefix svhn_tinierssd --checkpoint-file trained/ai85-svhn-tinierssd-qat8-q.pth.tar --config-file networks/svhn-tinierssd.yaml --overlap-data $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix facedet_tinierssd --checkpoint-file trained/ai85-facedet-tinierssd-qat8-q.pth.tar --config-file networks/ai85-facedet-tinierssd.yaml --sample-input tests/sample_vggface2_facedetection.npy --fifo $COMMON_ARGS "$@" diff --git a/gen-demos-max78002.sh b/gen-demos-max78002.sh index e2ca9801..6a3a4076 100755 --- a/gen-demos-max78002.sh +++ b/gen-demos-max78002.sh @@ -14,12 +14,14 @@ python ai8xize.py --test-dir $TARGET --prefix kws20_v3_1 --checkpoint-file train python ai8xize.py --test-dir $TARGET --prefix kws20_v2_1 --checkpoint-file trained/ai87-kws20_v2-qat8-q.pth.tar --config-file networks/ai87-kws20-v2-hwc.yaml --softmax $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix mobilefacenet-112 --checkpoint-file trained/ai87-mobilefacenet-112-qat-q.pth.tar --config-file networks/ai87-mobilefacenet-112.yaml --fifo $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix cats-dogs --checkpoint-file trained/ai85-catsdogs-qat8-q.pth.tar --config-file networks/cats-dogs-hwc-no-fifo.yaml --softmax $COMMON_ARGS "$@" +python izer/add_fake_passthrough.py --input-checkpoint-path trained/ai85-camvid-unet-large-q.pth.tar --output-checkpoint-path trained/ai85-camvid-unet-large-fakept-q.pth.tar --layer-name pt --layer-depth 56 --layer-name-after-pt upconv3 "$@" python ai8xize.py --test-dir $TARGET --prefix camvid_unet --checkpoint-file trained/ai85-camvid-unet-large-fakept-q.pth.tar --config-file networks/camvid-unet-large-fakept.yaml $COMMON_ARGS --overlap-data --mlator --no-unload --max-checklines 8192 "$@" +python izer/add_fake_passthrough.py --input-checkpoint-path trained/ai85-aisegment-unet-large-q.pth.tar --output-checkpoint-path trained/ai85-aisegment-unet-large-fakept-q.pth.tar --layer-name pt --layer-depth 56 --layer-name-after-pt upconv3 "$@" python ai8xize.py --test-dir $TARGET --prefix aisegment_unet --checkpoint-file trained/ai85-aisegment-unet-large-fakept-q.pth.tar --config-file networks/aisegment-unet-large-fakept.yaml $COMMON_ARGS --overlap-data --mlator --no-unload --max-checklines 8192 "$@" python ai8xize.py --test-dir $TARGET --prefix svhn_tinierssd --checkpoint-file trained/ai85-svhn-tinierssd-qat8-q.pth.tar --config-file networks/svhn-tinierssd.yaml --overlap-data $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix cifar-100-effnet2 --checkpoint-file trained/ai87-cifar100-effnet2-qat8-q.pth.tar --config-file networks/ai87-cifar100-effnet2.yaml --softmax $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix cifar-100-mobilenet-v2-0.75 --checkpoint-file trained/ai87-cifar100-mobilenet-v2-0.75-qat8-q.pth.tar --config-file networks/ai87-cifar100-mobilenet-v2-0.75.yaml --softmax $COMMON_ARGS "$@" -python ai8xize.py --test-dir $TARGET --prefix effnetv2_imagenet --scale-output --softmax --checkpoint-file trained/ai87-imagenet-effnet2-q.pth.tar --config-file networks/ai87-imagenet-effnet2.yaml $COMMON_ARGS "$@" +python ai8xize.py --test-dir $TARGET --prefix effnetv2_imagenet --softmax --checkpoint-file trained/ai87-imagenet-effnet2-q.pth.tar --config-file networks/ai87-imagenet-effnet2.yaml $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix facedet_tinierssd --checkpoint-file trained/ai87-facedet-tinierssd-qat8-q.pth.tar --config-file networks/ai87-facedet-tinierssd.yaml --sample-input tests/sample_vggface2_facedetection.npy $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix pascalvoc_fpndetector --checkpoint-file trained/ai87-pascalvoc-fpndetector-qat8-q.pth.tar --config-file networks/ai87-pascalvoc-fpndetector.yaml --fifo --sample-input tests/sample_pascalvoc_256_320.npy --no-unload $COMMON_ARGS "$@" python ai8xize.py --test-dir $TARGET --prefix kinetics --checkpoint-file trained/ai85-kinetics-qat8-q.pth.tar --config-file networks/ai85-kinetics-actiontcn.yaml --overlap-data --softmax --zero-sram $COMMON_ARGS "$@" diff --git a/izer/commandline.py b/izer/commandline.py index c1677fad..a8b26aff 100644 --- a/izer/commandline.py +++ b/izer/commandline.py @@ -464,7 +464,7 @@ def get_parser() -> argparse.Namespace: help='GitHub repository name for update checking') group.add_argument('--yamllint', metavar='S', default='yamllint', help='name of linter for YAML files (default: yamllint)') - group.add_argument('--scale-output', action='store_true', default=False, + group.add_argument('--no-scale-output', action='store_true', default=False, help="scale output with final layer scale factor (default: false)") args = parser.parse_args() @@ -693,7 +693,7 @@ def set_state(args: argparse.Namespace) -> None: state.rtl_preload_weights = args.rtl_preload_weights state.runtest_filename = args.runtest_filename state.sample_filename = args.sample_filename - state.scale_output = args.scale_output + state.scale_output = not args.no_scale_output state.simple1b = args.simple1b state.sleep = args.deepsleep state.slow_load = args.slow_load diff --git a/izer/state.py b/izer/state.py index 6ec0fbff..3809b4b2 100644 --- a/izer/state.py +++ b/izer/state.py @@ -175,7 +175,7 @@ rtl_preload_weights: bool = False rtl_preload: bool = False runtest_filename: str = '' -scale_output: bool = False +scale_output: bool = True sample_filename: str = '' simple1b: bool = False simulated_sequence: List[Any] = []