Download examples/decode_efficientdet_capture.py from anan19990108/efficientdet-lite1-htp: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/anan19990108/efficientdet-lite1-htp/resolve/main/examples/decode_efficientdet_capture.py
- Command line
-
hf download hf://anan19990108/efficientdet-lite1-htp/examples/decode_efficientdet_capture.py
-
curl -L -o decode_efficientdet_capture.py https://huggingface.co/anan19990108/efficientdet-lite1-htp/resolve/main/examples/decode_efficientdet_capture.py
1.3 kB
| """Decode raw HTP output saved by the three documented device runners.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| import numpy as np | |
| from infer import decode, load_heads | |
| def main() -> None: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--runtime", choices=["tflite-qnn", "onnx-qnn", "native-qnn"], required=True) | |
| parser.add_argument("--capture-dir", type=Path, required=True) | |
| parser.add_argument("--image-id", type=int, required=True, | |
| help="Numeric stem of the input image's .bin file") | |
| parser.add_argument("--native-index", type=int, default=0, | |
| help="Zero-based line index of the QNN native input list") | |
| parser.add_argument("--image-size", type=Path, required=True) | |
| parser.add_argument("--anchors", type=Path, required=True) | |
| args = parser.parse_args() | |
| size = json.loads(args.image_size.read_text(encoding="utf-8")) | |
| anchors = np.fromfile(args.anchors, np.float32).reshape(27621, 4) | |
| boxes, scores, current_anchors = load_heads( | |
| args.runtime, args.capture_dir, args.image_id, args.native_index, anchors) | |
| print(json.dumps(decode(boxes, scores, current_anchors, | |
| (size["width"], size["height"])), indent=2)) | |
| if __name__ == "__main__": | |
| main() | |