Justin Chu
commited on
Commit
·
7149468
1
Parent(s):
28e748c
wip
Browse files- README.md +5 -0
- scripts/optimize.py +17 -0
README.md
CHANGED
|
@@ -8,4 +8,9 @@ base_model:
|
|
| 8 |
|
| 9 |
ONNX model converted and optimized from `BirdNET_GLOBAL_6K_V2.4_Model_FP32.tflite`.
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
Source: https://github.com/birdnet-team/BirdNET-Analyzer
|
|
|
|
| 8 |
|
| 9 |
ONNX model converted and optimized from `BirdNET_GLOBAL_6K_V2.4_Model_FP32.tflite`.
|
| 10 |
|
| 11 |
+
Files:
|
| 12 |
+
|
| 13 |
+
- `model.onnx`: Initial model converted with tf2onnx and edited using NVIDIA Nsight DL Designer
|
| 14 |
+
- `birdnet.onnx`: Model further optimized with the `scripts/optimize.py` script. Recommended
|
| 15 |
+
|
| 16 |
Source: https://github.com/birdnet-team/BirdNET-Analyzer
|
scripts/optimize.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import onnxscript
|
| 2 |
+
import onnx_ir as ir
|
| 3 |
+
import onnx_ir.passes.common
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class ReplaceDftWithMatMulRule(onnxscript.rewriter.RewriteRuleClassBase):
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
model = ir.load("model.onnx")
|
| 10 |
+
onnxscript.optimizer.optimize(
|
| 11 |
+
model, input_size_limit=1024 * 1024 * 1024, output_size_limit=1024 * 1024 * 1024
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
onnx_ir.passes.common.ClearMetadataAndDocStringPass()(model)
|
| 15 |
+
model.ir_version = 10
|
| 16 |
+
|
| 17 |
+
ir.save(model, "birdnet.onnx")
|