Update README.md
Browse files
README.md
CHANGED
|
@@ -16,6 +16,113 @@ base_model:
|
|
| 16 |
|
| 17 |
# Perch
|
| 18 |
|
| 19 |
-
tflite and onnx format of the Perch v2 model.
|
| 20 |
|
| 21 |
Source https://www.kaggle.com/models/google/bird-vocalization-classifier/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Perch
|
| 18 |
|
| 19 |
+
tflite and munually optimized onnx format of the Perch v2 model.
|
| 20 |
|
| 21 |
Source https://www.kaggle.com/models/google/bird-vocalization-classifier/
|
| 22 |
+
|
| 23 |
+
## Model information
|
| 24 |
+
|
| 25 |
+
```
|
| 26 |
+
ONNX Model Information:
|
| 27 |
+
Inputs:
|
| 28 |
+
- Name: inputs, Shape: ['batch', 160000], Type: tensor(float)
|
| 29 |
+
Outputs:
|
| 30 |
+
- Name: embedding, Shape: ['batch', 1536], Type: tensor(float)
|
| 31 |
+
- Name: spatial_embedding, Shape: ['batch', 16, 4, 1536], Type: tensor(float)
|
| 32 |
+
- Name: spectrogram, Shape: ['batch', 500, 128], Type: tensor(float)
|
| 33 |
+
- Name: label, Shape: ['batch', 14795], Type: tensor(float)
|
| 34 |
+
|
| 35 |
+
TFLite Model Information:
|
| 36 |
+
Inputs:
|
| 37 |
+
- Name: serving_default_inputs:0, Shape: [ 1 160000], Type: <class 'numpy.float32'>
|
| 38 |
+
Outputs:
|
| 39 |
+
- Name: StatefulPartitionedCall:0, Shape: [ 1 1536], Type: <class 'numpy.float32'>
|
| 40 |
+
- Name: StatefulPartitionedCall:2, Shape: [ 1 16 4 1536], Type: <class 'numpy.float32'>
|
| 41 |
+
- Name: StatefulPartitionedCall:3, Shape: [ 1 500 128], Type: <class 'numpy.float32'>
|
| 42 |
+
- Name: StatefulPartitionedCall:1, Shape: [ 1 14795], Type: <class 'numpy.float32'>
|
| 43 |
+
|
| 44 |
+
Generating random inputs:
|
| 45 |
+
- inputs: shape=(1, 160000), dtype=float32
|
| 46 |
+
|
| 47 |
+
Running ONNX model inference...
|
| 48 |
+
Running TFLite model inference...
|
| 49 |
+
|
| 50 |
+
================================================================================
|
| 51 |
+
COMPARISON RESULTS
|
| 52 |
+
================================================================================
|
| 53 |
+
|
| 54 |
+
Output 0:
|
| 55 |
+
ONNX Runtime shape: (1, 1536), dtype: float32
|
| 56 |
+
TFLite shape: (1, 1536), dtype: float32
|
| 57 |
+
|
| 58 |
+
ONNX Runtime vs TFLite:
|
| 59 |
+
Max difference: 0.0000007208
|
| 60 |
+
Mean difference: 0.0000001543
|
| 61 |
+
Relative tolerance: 1e-05
|
| 62 |
+
Absolute tolerance: 1e-05
|
| 63 |
+
✅ Outputs match within tolerance
|
| 64 |
+
|
| 65 |
+
Output 1:
|
| 66 |
+
ONNX Runtime shape: (1, 16, 4, 1536), dtype: float32
|
| 67 |
+
TFLite shape: (1, 16, 4, 1536), dtype: float32
|
| 68 |
+
|
| 69 |
+
ONNX Runtime vs TFLite:
|
| 70 |
+
Max difference: 0.0000131130
|
| 71 |
+
Mean difference: 0.0000005482
|
| 72 |
+
Relative tolerance: 1e-05
|
| 73 |
+
Absolute tolerance: 1e-05
|
| 74 |
+
✅ Outputs match within tolerance
|
| 75 |
+
|
| 76 |
+
Output 2:
|
| 77 |
+
ONNX Runtime shape: (1, 500, 128), dtype: float32
|
| 78 |
+
TFLite shape: (1, 500, 128), dtype: float32
|
| 79 |
+
|
| 80 |
+
ONNX Runtime vs TFLite:
|
| 81 |
+
Max difference: 0.0000005960
|
| 82 |
+
Mean difference: 0.0000000100
|
| 83 |
+
Relative tolerance: 1e-05
|
| 84 |
+
Absolute tolerance: 1e-05
|
| 85 |
+
✅ Outputs match within tolerance
|
| 86 |
+
|
| 87 |
+
Output 3:
|
| 88 |
+
ONNX Runtime shape: (1, 14795), dtype: float32
|
| 89 |
+
TFLite shape: (1, 14795), dtype: float32
|
| 90 |
+
|
| 91 |
+
ONNX Runtime vs TFLite:
|
| 92 |
+
Max difference: 0.0000152588
|
| 93 |
+
Mean difference: 0.0000014861
|
| 94 |
+
Relative tolerance: 1e-05
|
| 95 |
+
Absolute tolerance: 1e-05
|
| 96 |
+
✅ Outputs match within tolerance
|
| 97 |
+
|
| 98 |
+
================================================================================
|
| 99 |
+
✅ ALL OUTPUTS MATCH!
|
| 100 |
+
================================================================================
|
| 101 |
+
|
| 102 |
+
Benchmarking ONNX model (10 warmup + 100 test runs)...
|
| 103 |
+
Benchmarking TFLite model (10 warmup + 100 test runs)...
|
| 104 |
+
|
| 105 |
+
================================================================================
|
| 106 |
+
BENCHMARK RESULTS
|
| 107 |
+
================================================================================
|
| 108 |
+
|
| 109 |
+
ONNX Model:
|
| 110 |
+
Mean: 66.350 ms
|
| 111 |
+
Median: 66.339 ms
|
| 112 |
+
Std: 2.160 ms
|
| 113 |
+
Min: 61.801 ms
|
| 114 |
+
Max: 74.614 ms
|
| 115 |
+
|
| 116 |
+
TFLite Model:
|
| 117 |
+
Mean: 608.777 ms
|
| 118 |
+
Median: 606.753 ms
|
| 119 |
+
Std: 11.304 ms
|
| 120 |
+
Min: 602.735 ms
|
| 121 |
+
Max: 684.807 ms
|
| 122 |
+
|
| 123 |
+
Comparison:
|
| 124 |
+
ONNX Runtime is 9.18x faster than TFLite
|
| 125 |
+
Difference: 542.427 ms
|
| 126 |
+
================================================================================
|
| 127 |
+
```
|
| 128 |
+
|