Realcat commited on
Commit
778fe92
·
verified ·
1 Parent(s): ac5bcb0

fix(mixvpr): re-export ALL models with the trained checkpoint loaded

Browse files

Previous onnx/coreml exports never loaded resnet50_MixVPR_4096_channels(1024)_rows(4).ckpt — they shipped an ImageNet backbone with a randomly initialized aggregator, and the CosSim checks passed because the PyTorch reference was the same unloaded model. Symptom: same-image 90%-crop cosine ~0.48 (should be ~0.77); indoor relocalization recall@2m 59.5% -> 94.8% after the fix.

Export scripts now load the ckpt inside the model constructor with a strict key check and refuse to run without it.

mixvpr/README.md CHANGED
@@ -4,12 +4,21 @@ Exported and quantized models for [MixVPR](https://github.com/Vincentqyw/MixVPR)
4
 
5
  ## Models
6
 
 
 
 
 
 
 
 
 
 
7
  | Format | File | Size | Latency (M-series) | CosSim | Status |
8
  |---|---|---|---|---|---|
9
- | ONNX FP32 | `onnx/mixvpr_fp32.onnx` | 41.7 MB | 32.4 ms | 1.0000 | ✓ |
10
- | ONNX FP16 | `onnx/mixvpr_fp16.onnx` | 21.0 MB | 38.2 ms | 0.9999 | ✓ Recommended |
11
- | CoreML FP16 | `coreml/mixvpr_fp16.mlpackage/` | 20.8 MB | **3.1 ms** | 0.9999 | ✓ Recommended |
12
- | CoreML INT8 | `coreml/mixvpr_int8.mlpackage/` | 10.5 MB | **3.3 ms** | 0.9983 | ✓ |
13
 
14
  ## Benchmark
15
 
@@ -19,23 +28,30 @@ All models were benchmarked against the original PyTorch FP32 model on a MacBook
19
 
20
  | Model | Latency | Speedup |
21
  |---|---|---|
22
- | PyTorch FP32 (reference) | 44.5 ms | 1.0× |
23
- | ONNX FP32 | 32.4 ms | 1.4× |
24
- | ONNX FP16 | 38.2 ms | 1.2× |
25
- | **CoreML FP16** | **3.1 ms** | **14.6×** |
26
- | **CoreML INT8** | **3.3 ms** | **13.5×** |
27
 
28
  ### Accuracy (cosine similarity vs PyTorch)
29
 
 
 
 
30
  | Model | CosSim | Max Abs Error | Verdict |
31
  |---|---|---|---|
32
- | ONNX FP32 | 1.0000 | 1.9×10⁻⁷ | No drop |
33
- | ONNX FP16 | 0.9999 | 1.7×10⁻⁴ | No drop |
34
- | CoreML FP16 | 0.9999 | 3.2×10⁻⁴ | No drop |
35
- | CoreML INT8 | 0.9983 | 3.5×10⁻³ | Negligible |
 
 
 
 
36
 
37
  - CosSim > 0.9999 means retrieval results are **identical** to PyTorch.
38
- - CosSim 0.9983 means top-1 may shift for borderline cases; top-10 remains stable.
39
 
40
  ### File Size
41
 
 
4
 
5
  ## Models
6
 
7
+ > **⚠️ 2026-08-09 — all models re-exported, please re-download.** Every file
8
+ > uploaded before this date was exported **without the trained MixVPR
9
+ > checkpoint** (ImageNet backbone + randomly initialized aggregator): the
10
+ > export scripts never loaded the weights, and the CosSim checks compared
11
+ > against the same unloaded model, so they passed. Quick way to spot the
12
+ > broken files: embed any image and its 90% crop — broken ≈ 0.48 cosine,
13
+ > fixed ≈ 0.77. On an indoor relocalization benchmark the fix moved
14
+ > recall@2m from 59.5% to 94.8%.
15
+
16
  | Format | File | Size | Latency (M-series) | CosSim | Status |
17
  |---|---|---|---|---|---|
18
+ | ONNX FP32 | `onnx/mixvpr_fp32.onnx` | 41.7 MB | 30.9 ms | 1.0000 | ✓ |
19
+ | ONNX FP16 | `onnx/mixvpr_fp16.onnx` | 21.0 MB | 37.8 ms | 0.9999 | ✓ Recommended |
20
+ | CoreML FP16 | `coreml/mixvpr_fp16.mlpackage/` | 20.8 MB | **2.9 ms** | 0.9998 | ✓ Recommended |
21
+ | CoreML INT8 | `coreml/mixvpr_int8.mlpackage/` | 10.5 MB | **3.1 ms** | 0.9985 | ✓ |
22
 
23
  ## Benchmark
24
 
 
28
 
29
  | Model | Latency | Speedup |
30
  |---|---|---|
31
+ | PyTorch FP32 (reference) | 43.3 ms | 1.0× |
32
+ | ONNX FP32 | 30.9 ms | 1.4× |
33
+ | ONNX FP16 | 37.8 ms | 1.15× |
34
+ | **CoreML FP16** | **2.9 ms** | **12.0×** |
35
+ | **CoreML INT8** | **3.1 ms** | **11.5×** |
36
 
37
  ### Accuracy (cosine similarity vs PyTorch)
38
 
39
+ Reference = PyTorch with `resnet50_MixVPR_4096_channels(1024)_rows(4).ckpt`
40
+ loaded under a strict key check (measured 2026-08-09):
41
+
42
  | Model | CosSim | Max Abs Error | Verdict |
43
  |---|---|---|---|
44
+ | ONNX FP32 | 1.0000 | 1.2×10⁻⁷ | No drop |
45
+ | ONNX FP16 | 0.9999+ | 1.3×10⁻⁴ | No drop |
46
+ | CoreML FP16 | 0.9998 | 2.7×10⁻⁴ | No drop |
47
+ | CoreML INT8 | 0.9985 | 3.8×10⁻³ | Negligible |
48
+
49
+ **Integrity probe** (catches an unloaded-weights export without any dataset):
50
+ embed an image and its 90% crop — trained MixVPR scores ~0.75–0.85 cosine,
51
+ an untrained export ~0.5.
52
 
53
  - CosSim > 0.9999 means retrieval results are **identical** to PyTorch.
54
+ - CosSim 0.9985 means top-1 may shift for borderline cases; top-10 remains stable.
55
 
56
  ### File Size
57
 
mixvpr/coreml/mixvpr_fp16.mlpackage/Data/com.apple.CoreML/model.mlmodel CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ea376be4f5f40171cba5d7216f2d56a40f2234f3d3201f5eea3aa8dc7857ad28
3
- size 73801
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f14a00146c0987c144381f85ae22ec550f4999d00368b95606f5f57c6ef7c092
3
+ size 76413
mixvpr/coreml/mixvpr_fp16.mlpackage/Data/com.apple.CoreML/weights/weight.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:074bbab3e407fb63c4d3dce12f5d2d876e1823f86b5dbe38462839a8ebe32a17
3
- size 21726464
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa58b1fb7f0a4bd2fa490a257917712e835c7d8f5ff506aef0a08c878ddb9f97
3
+ size 21739008
mixvpr/coreml/mixvpr_fp16.mlpackage/Manifest.json CHANGED
@@ -1,18 +1,18 @@
1
  {
2
  "fileFormatVersion": "1.0.0",
3
  "itemInfoEntries": {
4
- "6956CE61-9253-4FAA-A6C1-5B87134E1AE3": {
5
- "author": "com.apple.CoreML",
6
- "description": "CoreML Model Weights",
7
- "name": "weights",
8
- "path": "com.apple.CoreML/weights"
9
- },
10
- "E5E07CDC-859D-41B8-A3C9-A7E56F4937B0": {
11
  "author": "com.apple.CoreML",
12
  "description": "CoreML Model Specification",
13
  "name": "model.mlmodel",
14
  "path": "com.apple.CoreML/model.mlmodel"
 
 
 
 
 
 
15
  }
16
  },
17
- "rootModelIdentifier": "E5E07CDC-859D-41B8-A3C9-A7E56F4937B0"
18
  }
 
1
  {
2
  "fileFormatVersion": "1.0.0",
3
  "itemInfoEntries": {
4
+ "7188AE4C-979C-49C5-A64F-EA379370910A": {
 
 
 
 
 
 
5
  "author": "com.apple.CoreML",
6
  "description": "CoreML Model Specification",
7
  "name": "model.mlmodel",
8
  "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "8DA552E4-344B-4CF9-971E-085DB8264A33": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
  }
16
  },
17
+ "rootModelIdentifier": "7188AE4C-979C-49C5-A64F-EA379370910A"
18
  }
mixvpr/coreml/mixvpr_int8.mlpackage/Data/com.apple.CoreML/model.mlmodel CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:29dfbbb290c5e94f167e78e5a9d2e0c13efea480990bb3fdf05ce1242f9c2cf0
3
- size 85310
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:896125fc6a8e2796e6acf45d50607693ab4b3f7a2424d62511c6808d38a539c8
3
+ size 87924
mixvpr/coreml/mixvpr_int8.mlpackage/Data/com.apple.CoreML/weights/weight.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9890698ff36bcc9bfd08ce5bf784989084f17a9c8336a5752349d9891ae922eb
3
- size 10954816
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3bedbf2b1d1ab82a770259518aaad719551556a036dc0cb4ea2828fb4103e02f
3
+ size 10967360
mixvpr/coreml/mixvpr_int8.mlpackage/Manifest.json CHANGED
@@ -1,18 +1,18 @@
1
  {
2
  "fileFormatVersion": "1.0.0",
3
  "itemInfoEntries": {
4
- "09A8753A-0D63-4659-ABB0-19A71E56A4D4": {
5
- "author": "com.apple.CoreML",
6
- "description": "CoreML Model Specification",
7
- "name": "model.mlmodel",
8
- "path": "com.apple.CoreML/model.mlmodel"
9
- },
10
- "C3039F61-58A4-452B-81C0-7608A59ECB05": {
11
  "author": "com.apple.CoreML",
12
  "description": "CoreML Model Weights",
13
  "name": "weights",
14
  "path": "com.apple.CoreML/weights"
 
 
 
 
 
 
15
  }
16
  },
17
- "rootModelIdentifier": "09A8753A-0D63-4659-ABB0-19A71E56A4D4"
18
  }
 
1
  {
2
  "fileFormatVersion": "1.0.0",
3
  "itemInfoEntries": {
4
+ "A85F9554-4CEB-4FC9-9F9D-A3729FBEEA3F": {
 
 
 
 
 
 
5
  "author": "com.apple.CoreML",
6
  "description": "CoreML Model Weights",
7
  "name": "weights",
8
  "path": "com.apple.CoreML/weights"
9
+ },
10
+ "D70982A7-E698-4746-B9BB-0A0E8900AA91": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Specification",
13
+ "name": "model.mlmodel",
14
+ "path": "com.apple.CoreML/model.mlmodel"
15
  }
16
  },
17
+ "rootModelIdentifier": "D70982A7-E698-4746-B9BB-0A0E8900AA91"
18
  }
mixvpr/onnx/mixvpr_fp16.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2afcfb51cd13ed96b242c80f809dae7a47ccbbaf0a6cd3a31f93e39b45dee311
3
- size 22006700
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fee89548fdc8066d2464f00d5672363868459c8d6346c33bf2d2aea3b7e13c86
3
+ size 22021838
mixvpr/onnx/mixvpr_fp32.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5cf761edb201329529cc42d68eff835a8e29d60f4858af5a99ee026334abc17b
3
- size 43725770
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ede695b528f99b4d4ad3da940c9fe8d62f07254cbb0871205d669816ee97f47
3
+ size 43752108