YoKONCy commited on
Commit
6dce3ef
·
verified ·
1 Parent(s): ac38afa

Release MERU-ImageNet-1M v1.0

Browse files

Publish 1M hyperbolic image vectors, exact FP64 neighbor ground truth, provenance, reproduction scripts, and dataset documentation.

.gitattributes CHANGED
@@ -58,3 +58,15 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ documents.f32 filter=lfs diff=lfs merge=lfs -text
62
+ documents_model_spatial.f32 filter=lfs diff=lfs merge=lfs -text
63
+ queries.f32 filter=lfs diff=lfs merge=lfs -text
64
+ queries_model_spatial.f32 filter=lfs diff=lfs merge=lfs -text
65
+ queries_top100.u64 filter=lfs diff=lfs merge=lfs -text
66
+ queries_top100_distances.f64 filter=lfs diff=lfs merge=lfs -text
67
+ truth.u64 filter=lfs diff=lfs merge=lfs -text
68
+ tuning_queries.f32 filter=lfs diff=lfs merge=lfs -text
69
+ tuning_queries_model_spatial.f32 filter=lfs diff=lfs merge=lfs -text
70
+ tuning_queries_top100.u64 filter=lfs diff=lfs merge=lfs -text
71
+ tuning_queries_top100_distances.f64 filter=lfs diff=lfs merge=lfs -text
72
+ tuning_truth.u64 filter=lfs diff=lfs merge=lfs -text
LICENSE.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MERU-ImageNet-1M licensing and attribution
2
+
3
+ Copyright 2026 Astrmira Tech.
4
+
5
+ Astrmira Tech's benchmark curation and accompanying release documentation are licensed under Creative Commons Attribution-NonCommercial 4.0 International. Attribution should identify MERU-ImageNet-1M, Astrmira Tech, the release version, and any modifications. The full license text is available at https://creativecommons.org/licenses/by-nc/4.0/legalcode.
6
+
7
+ The vectors were generated using the official MERU ViT-small checkpoint. MERU is distributed under CC BY-NC 4.0, with separately identified portions of its project under other licenses. Its original license is preserved in `licenses/MERU-LICENSE.txt`. Source and additional notices are available at https://github.com/facebookresearch/meru.
8
+
9
+ The source images belong to ImageNet ILSVRC2012. ImageNet's terms govern the source database and its permitted non-commercial research and educational use. Users obtaining or using the source images must comply with the applicable ImageNet access terms and underlying image rights. The benchmark curation license covers Astrmira Tech's contribution. Upstream rights remain with their respective holders.
10
+
11
+ ImageNet access information and terms are available at https://image-net.org/ and https://huggingface.co/datasets/ILSVRC/imagenet-1k.
12
+
13
+ The companion preparation scripts and NumPy loader are licensed under Apache-2.0. See `licenses/Apache-2.0.txt`. The original preparation scripts are preserved as provenance artifacts. The Pelorus software repository is available at https://github.com/Astrmira/Pelorus.
README.md ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: MERU-ImageNet-1M
3
+ language:
4
+ - en
5
+ license: cc-by-nc-4.0
6
+ size_categories:
7
+ - 1M<n<10M
8
+ tags:
9
+ - hyperbolic
10
+ - approximate-nearest-neighbor
11
+ - vector-search
12
+ - imagenet
13
+ - meru
14
+ - poincare
15
+ - lorentz
16
+ - benchmark
17
+ ---
18
+
19
+ # MERU-ImageNet-1M
20
+
21
+ **A Million-Scale Hyperbolic Vector Search Benchmark**
22
+
23
+ MERU-ImageNet-1M contains 1,000,000 database vectors, 10,000 test queries, and 2,000 tuning queries in 512-dimensional hyperbolic space. Astrmira Tech prepared the benchmark by encoding ILSVRC2012 images with the official MERU ViT-small checkpoint and computing exhaustive FP64 nearest-neighbor ground truth.
24
+
25
+ The release provides canonical Poincaré coordinates at curvature −1, the model's original Lorentz spatial components, top-10 and top-100 neighbors, distances, image provenance records, and the frozen preparation scripts.
26
+
27
+ ## Splits
28
+
29
+ | Split | Source images | Vectors | Dimensions |
30
+ |---|---|---:|---:|
31
+ | Database | ILSVRC2012 training images | 1,000,000 | 512 |
32
+ | Test queries | ILSVRC2012 validation images | 10,000 | 512 |
33
+ | Tuning queries | ILSVRC2012 validation images | 2,000 | 512 |
34
+
35
+ The complete training and validation archives were encoded before subset selection. Image IDs, image SHA256 hashes, and canonical vector-byte SHA256 hashes were deduplicated globally. A fixed random seed of `20261114` identifies the preparation run. The selected splits have disjoint image IDs, image hashes, and vector hashes.
36
+
37
+ ## Download and load
38
+
39
+ ```bash
40
+ pip install huggingface_hub numpy
41
+ hf download YoKONCy/MERU-ImageNet-1M --repo-type dataset --local-dir MERU-ImageNet-1M
42
+ ```
43
+
44
+ ```python
45
+ import sys
46
+ from pathlib import Path
47
+
48
+ root = Path("MERU-ImageNet-1M")
49
+ sys.path.insert(0, str(root.resolve()))
50
+ from load_dataset import load_benchmark
51
+
52
+ data = load_benchmark(root)
53
+ database = data["documents"]
54
+ queries = data["queries"]
55
+ truth = data["truth"]
56
+ print(database.shape, queries.shape, truth.shape)
57
+ ```
58
+
59
+ The arrays are read-only NumPy memory maps. The canonical database occupies 2,048,000,000 bytes. The complete release is approximately 4.32 GB, including the original model-space representation and provenance.
60
+
61
+ For a selective download of the canonical benchmark, use the following files with `snapshot_download`.
62
+
63
+ ```python
64
+ from huggingface_hub import snapshot_download
65
+
66
+ snapshot_download(
67
+ repo_id="YoKONCy/MERU-ImageNet-1M",
68
+ repo_type="dataset",
69
+ local_dir="MERU-ImageNet-1M",
70
+ allow_patterns=[
71
+ "documents.f32", "queries.f32", "tuning_queries.f32",
72
+ "truth.u64", "tuning_truth.u64", "mapping.json",
73
+ "load_dataset.py", "README.md", "LICENSE*", "SHA256SUMS",
74
+ ],
75
+ )
76
+ ```
77
+
78
+ ## File formats
79
+
80
+ All binary arrays are headerless, little-endian, and stored in row-major order. Neighbor IDs are zero-based row indices into `documents.f32`.
81
+
82
+ | File | Shape | Element type | Contents |
83
+ |---|---|---|---|
84
+ | `documents.f32` | 1,000,000 × 512 | float32 | Canonical database coordinates |
85
+ | `queries.f32` | 10,000 × 512 | float32 | Canonical test queries |
86
+ | `tuning_queries.f32` | 2,000 × 512 | float32 | Canonical tuning queries |
87
+ | `truth.u64` | 10,000 × 10 | uint64 | Test top-10 neighbor IDs |
88
+ | `tuning_truth.u64` | 2,000 × 10 | uint64 | Tuning top-10 neighbor IDs |
89
+ | `queries_top100.u64` | 10,000 × 100 | uint64 | Test top-100 neighbor IDs |
90
+ | `queries_top100_distances.f64` | 10,000 × 100 | float64 | Test top-100 geodesic distances |
91
+ | `tuning_queries_top100.u64` | 2,000 × 100 | uint64 | Tuning top-100 neighbor IDs |
92
+ | `tuning_queries_top100_distances.f64` | 2,000 × 100 | float64 | Tuning top-100 geodesic distances |
93
+ | `documents_model_spatial.f32` | 1,000,000 × 512 | float32 | Original Lorentz spatial components |
94
+ | `queries_model_spatial.f32` | 10,000 × 512 | float32 | Original test Lorentz spatial components |
95
+ | `tuning_queries_model_spatial.f32` | 2,000 × 512 | float32 | Original tuning Lorentz spatial components |
96
+
97
+ The three `*_manifest.jsonl.gz` files associate vector rows with image IDs, source splits, TAR members, archive offsets, image MD5/SHA256 hashes, and canonical vector SHA256 hashes. Database provenance also includes ImageNet synset IDs.
98
+
99
+ `mapping.json` records the model checkpoint hash, source commit, curvature, software versions, source archive hashes, preparation parameters, and binary-file hashes. `splits_complete.json` records split statistics and database class counts. `verification.json` and `provenance/data_audit.json` preserve the ground-truth and integrity checks.
100
+
101
+ `SHA256SUMS` covers every published file other than the checksum list itself.
102
+
103
+ ## Geometry
104
+
105
+ Let $y\in\mathbb{R}^{512}$ denote the stored model-space Lorentz spatial component and let $c=0.10000000149011612$ be the original positive curvature magnitude. The canonical Poincaré coordinates are
106
+
107
+ $$
108
+ z=\sqrt{c}\,y,\qquad
109
+ x=\frac{z}{\sqrt{1+\lVert z\rVert^2}+1}.
110
+ $$
111
+
112
+ The conversion uses FP64 arithmetic followed by an FP32 cast. Every published canonical vector lies strictly inside the unit ball.
113
+
114
+ Canonical geodesic distance is
115
+
116
+ $$
117
+ d(x,q)=\operatorname{arcosh}\!\left(
118
+ 1+\frac{2\lVert x-q\rVert^2}
119
+ {(1-\lVert x\rVert^2)(1-\lVert q\rVert^2)}
120
+ \right).
121
+ $$
122
+
123
+ The corresponding distance at the original model curvature is $d(x,q)/\sqrt{c}$. The shared scale factor preserves nearest-neighbor rankings. Stored top-100 distances use canonical curvature −1 and the published FP32 canonical coordinates.
124
+
125
+ ## Ground truth and evaluation
126
+
127
+ Every test and tuning query was exhaustively compared against all 1,000,000 database vectors using FP64 arithmetic. Neighbors are ordered by increasing distance, with database row ID breaking exact ties. The top-10 files contain the first ten IDs from the corresponding top-100 files.
128
+
129
+ An independent CPU full scan using direct coordinate differences reproduced all top-100 IDs for 16 fixed test queries. Its maximum distance discrepancy was approximately $2.57\times10^{-15}$. Additional release checks cover file hashes, finite coordinates, ball membership, split disjointness, neighbor ID ranges, ordering, and stored distances.
130
+
131
+ For ANN evaluation, compute Recall@10 as the mean fraction of the ten ground-truth IDs returned for each test query. Select search parameters using the tuning queries. Report the distance convention, query concurrency, build parameters, latency, and throughput alongside recall.
132
+
133
+ The benchmark measures geometric nearest-neighbor retrieval under the MERU-ImageNet embedding distribution. Database Euclidean radii range from approximately 0.11673 to 0.13501. `splits_complete.json` provides the complete recorded quantiles.
134
+
135
+ ## Provenance and reproduction
136
+
137
+ - Encoder family is MERU ViT-small, with 512 output dimensions.
138
+ - MERU source commit is `6d4430055f58354539f68668175135256f99d47f`.
139
+ - Checkpoint SHA256 is `4466c04a790d9b5974928e7e9e528cbff2d82348f596e60443a88934b9a61de6`.
140
+ - Encoding uses FP32, with TF32 disabled, batch size 128, and eight image-decoding workers.
141
+ - ILSVRC2012 training archive MD5 is `1d675b47d978889d74fa0da5fadfb00e`.
142
+ - ILSVRC2012 validation archive MD5 is `29b22e2961454d5413ddabcf34fc5622`.
143
+
144
+ The original preparation scripts and their recorded hashes are included under `reproduction/`. The reproduction guide describes their Linux/CUDA environment and source-directory conventions. Source image archives are obtained through ImageNet's access process. [MERU project](https://github.com/facebookresearch/meru), [official checkpoint](https://dl.fbaipublicfiles.com/meru/meru_vit_s.pth), [ImageNet](https://image-net.org/).
145
+
146
+ ## License and attribution
147
+
148
+ Astrmira Tech releases its benchmark curation under CC BY-NC 4.0. The release retains MERU's CC BY-NC 4.0 notice and ImageNet's non-commercial research and educational use terms. The upstream materials remain subject to their respective rights and access terms. See `LICENSE.md`, `licenses/MERU-LICENSE.txt`, and the upstream sources. [MERU license](https://github.com/facebookresearch/meru/blob/main/LICENSE), [ImageNet terms](https://huggingface.co/datasets/ILSVRC/imagenet-1k).
149
+
150
+ ## Citation
151
+
152
+ ```bibtex
153
+ @misc{astrmira2026meruimagenet1m,
154
+ title = {MERU-ImageNet-1M — A Million-Scale Hyperbolic Vector Search Benchmark},
155
+ author = {Xiao, Wenxuan and Cao, Xu},
156
+ year = {2026},
157
+ version = {1.0},
158
+ publisher = {Astrmira Tech},
159
+ howpublished = {Hugging Face},
160
+ url = {https://huggingface.co/datasets/YoKONCy/MERU-ImageNet-1M}
161
+ }
162
+
163
+ @inproceedings{desai2023meru,
164
+ title = {Hyperbolic Image-Text Representations},
165
+ author = {Desai, Karan and Nickel, Maximilian and Rajpurohit, Tanmay and Johnson, Justin and Vedantam, Ramakrishna},
166
+ booktitle = {Proceedings of the International Conference on Machine Learning},
167
+ year = {2023}
168
+ }
169
+
170
+ @article{russakovsky2015imagenet,
171
+ title = {ImageNet Large Scale Visual Recognition Challenge},
172
+ author = {Russakovsky, Olga and Deng, Jia and Su, Hao and Krause, Jonathan and Satheesh, Sanjeev and Ma, Sean and Huang, Zhiheng and Karpathy, Andrej and Khosla, Aditya and Bernstein, Michael and Berg, Alexander C. and Fei-Fei, Li},
173
+ journal = {International Journal of Computer Vision},
174
+ year = {2015},
175
+ volume = {115},
176
+ pages = {211--252}
177
+ }
178
+ ```
SHA256SUMS ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 850cbf75c0b3d9f02cd0aace724270fd53e5935209c0bb74690671a3602d9d9d documents.f32
2
+ bf177a85ad6ad757b27e071e3cb8805e4a43e68866a97195c89a2b9f7c5fe8f9 documents_manifest.jsonl.gz
3
+ b3b5e1df4a4ed6da59aa5937cacb4d351617c055ccfa7ce657b049f1d47cc58c documents_model_spatial.f32
4
+ cc739135a92fa15235a6255baad5e055a64654d3b77748898e67a0a274acf277 LICENSE.md
5
+ b939133662bcde79d3f1876bfbb9a40ea22b9d14f677a4b663b7b5f1ac7691a3 licenses/Apache-2.0.txt
6
+ 43a372304b1da21ff143b9dd10424d93dc193073aecd5984a6b3872416dc7acd licenses/MERU-LICENSE.txt
7
+ cd34e6ca8e3409306ca9fb79737cbbe7fc9bd3f5d52791f90a72e6acfc8f5d7c load_dataset.py
8
+ 26ea929d21c539590c20963afd430716f20ced51960f75c72cdb5db1c34cbe30 mapping.json
9
+ 2a13098b1b5854aa686a59263a7cd6d25ecc000fffcec2ab0e5944f5c1101636 provenance/data_audit.json
10
+ 2312d6583b655ef284d010176ed76d75dbfa6c573e0b9aa2a71ad76cd48f9100 provenance/encoding_config.json
11
+ 291d13b5920b2b8b0299ace12b0ae93d36864b5ce06075c0cc372afa13dd36c6 provenance/generation_README.zh.md
12
+ 94a3f4d8bc64e2a1e8920a323520c2f781fa687e4aa69d29e646b35d83a78e97 queries.f32
13
+ c666cac67b152fd4bc62f2d0c17bb914e9de9f8ecd401c394e7d3822b060d906 queries_manifest.jsonl.gz
14
+ 893ee28f1627f15b80569b41e0aa5ddc244e222dd3f819d67cefbb9c1afbe981 queries_model_spatial.f32
15
+ d98425d52f8eb909262043681c322f6a1cebe53e9b02ea079cc2901b93e8fcfb queries_top100.u64
16
+ 467f0344674a08c0443e10f145481a94370f5c2ee7c1b32735d52508984d1fe0 queries_top100_distances.f64
17
+ f5c71c929b1766d125e658178eee3c7eea613e622107536ea3ef65e7b6651904 README.md
18
+ 26b2be6be326c3b217ba17fef7b89311f9cd4d1aefc252df36a646f82be4c40e reproduction/build_imagenet.py
19
+ 9eb69e56f3e9ce211dcdcb86ffca16d11e81440d0d98c922911a5f61c623ce35 reproduction/dataset_common.py
20
+ f4bc78850fff7a200691e6e7e3988b0a208899b486a0860dfead71c144568d06 reproduction/README.md
21
+ ef6b59b30fe945bb2e57ef58dfcac400ae8cbd7804e8f39b2110cac08ee01611 splits_complete.json
22
+ 29f8527da3f0a19167cd4c0a08c659cd7cce178daabb02a887b5cbf96ae0de0d truth.u64
23
+ c8b74bd19555662f2fc2562f0816041a52e2cc554fe5d2bb734668d47f1d503f truth_complete.json
24
+ 3fd4402ad74df5bd28afba4a1cf34b68aaa896950965b29f8cc788ecf44d21f1 tuning_queries.f32
25
+ 4e0b6abfad81abd9de652acf93081a138940b407cf667e7f8e342b946d46cf38 tuning_queries_manifest.jsonl.gz
26
+ c1360a715564e5d72480843467173a520de91c3231cd178c5d6f970f7cda5d77 tuning_queries_model_spatial.f32
27
+ d5882665541c5fa02297f0da995d078b1a2814554ce9170f05c33cbcae6ddd86 tuning_queries_top100.u64
28
+ caad600d70162c774146742d264f28b432831ff04660daa6536bba9030fbea91 tuning_queries_top100_distances.f64
29
+ bd3cf4c7fd1ce2ef7b039d41e1a2c344708aff76ea66aee91e65ee067fa0bb7e tuning_truth.u64
30
+ cbd0266b3c1284c60df2b42caebcffd4657919a6f57086789d885ab2b72aa535 verification.json
documents.f32 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:850cbf75c0b3d9f02cd0aace724270fd53e5935209c0bb74690671a3602d9d9d
3
+ size 2048000000
documents_manifest.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf177a85ad6ad757b27e071e3cb8805e4a43e68866a97195c89a2b9f7c5fe8f9
3
+ size 147340702
documents_model_spatial.f32 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b3b5e1df4a4ed6da59aa5937cacb4d351617c055ccfa7ce657b049f1d47cc58c
3
+ size 2048000000
licenses/Apache-2.0.txt ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2024 TriviumDB Authors (https://github.com/YoKONCy)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
licenses/MERU-LICENSE.txt ADDED
@@ -0,0 +1,407 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Attribution-NonCommercial 4.0 International
2
+
3
+ =======================================================================
4
+
5
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
6
+ does not provide legal services or legal advice. Distribution of
7
+ Creative Commons public licenses does not create a lawyer-client or
8
+ other relationship. Creative Commons makes its licenses and related
9
+ information available on an "as-is" basis. Creative Commons gives no
10
+ warranties regarding its licenses, any material licensed under their
11
+ terms and conditions, or any related information. Creative Commons
12
+ disclaims all liability for damages resulting from their use to the
13
+ fullest extent possible.
14
+
15
+ Using Creative Commons Public Licenses
16
+
17
+ Creative Commons public licenses provide a standard set of terms and
18
+ conditions that creators and other rights holders may use to share
19
+ original works of authorship and other material subject to copyright
20
+ and certain other rights specified in the public license below. The
21
+ following considerations are for informational purposes only, are not
22
+ exhaustive, and do not form part of our licenses.
23
+
24
+ Considerations for licensors: Our public licenses are
25
+ intended for use by those authorized to give the public
26
+ permission to use material in ways otherwise restricted by
27
+ copyright and certain other rights. Our licenses are
28
+ irrevocable. Licensors should read and understand the terms
29
+ and conditions of the license they choose before applying it.
30
+ Licensors should also secure all rights necessary before
31
+ applying our licenses so that the public can reuse the
32
+ material as expected. Licensors should clearly mark any
33
+ material not subject to the license. This includes other CC-
34
+ licensed material, or material used under an exception or
35
+ limitation to copyright. More considerations for licensors:
36
+ wiki.creativecommons.org/Considerations_for_licensors
37
+
38
+ Considerations for the public: By using one of our public
39
+ licenses, a licensor grants the public permission to use the
40
+ licensed material under specified terms and conditions. If
41
+ the licensor's permission is not necessary for any reason--for
42
+ example, because of any applicable exception or limitation to
43
+ copyright--then that use is not regulated by the license. Our
44
+ licenses grant only permissions under copyright and certain
45
+ other rights that a licensor has authority to grant. Use of
46
+ the licensed material may still be restricted for other
47
+ reasons, including because others have copyright or other
48
+ rights in the material. A licensor may make special requests,
49
+ such as asking that all changes be marked or described.
50
+ Although not required by our licenses, you are encouraged to
51
+ respect those requests where reasonable. More considerations
52
+ for the public:
53
+ wiki.creativecommons.org/Considerations_for_licensees
54
+
55
+ =======================================================================
56
+
57
+ Creative Commons Attribution-NonCommercial 4.0 International Public
58
+ License
59
+
60
+ By exercising the Licensed Rights (defined below), You accept and agree
61
+ to be bound by the terms and conditions of this Creative Commons
62
+ Attribution-NonCommercial 4.0 International Public License ("Public
63
+ License"). To the extent this Public License may be interpreted as a
64
+ contract, You are granted the Licensed Rights in consideration of Your
65
+ acceptance of these terms and conditions, and the Licensor grants You
66
+ such rights in consideration of benefits the Licensor receives from
67
+ making the Licensed Material available under these terms and
68
+ conditions.
69
+
70
+
71
+ Section 1 -- Definitions.
72
+
73
+ a. Adapted Material means material subject to Copyright and Similar
74
+ Rights that is derived from or based upon the Licensed Material
75
+ and in which the Licensed Material is translated, altered,
76
+ arranged, transformed, or otherwise modified in a manner requiring
77
+ permission under the Copyright and Similar Rights held by the
78
+ Licensor. For purposes of this Public License, where the Licensed
79
+ Material is a musical work, performance, or sound recording,
80
+ Adapted Material is always produced where the Licensed Material is
81
+ synched in timed relation with a moving image.
82
+
83
+ b. Adapter's License means the license You apply to Your Copyright
84
+ and Similar Rights in Your contributions to Adapted Material in
85
+ accordance with the terms and conditions of this Public License.
86
+
87
+ c. Copyright and Similar Rights means copyright and/or similar rights
88
+ closely related to copyright including, without limitation,
89
+ performance, broadcast, sound recording, and Sui Generis Database
90
+ Rights, without regard to how the rights are labeled or
91
+ categorized. For purposes of this Public License, the rights
92
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
93
+ Rights.
94
+ d. Effective Technological Measures means those measures that, in the
95
+ absence of proper authority, may not be circumvented under laws
96
+ fulfilling obligations under Article 11 of the WIPO Copyright
97
+ Treaty adopted on December 20, 1996, and/or similar international
98
+ agreements.
99
+
100
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
101
+ any other exception or limitation to Copyright and Similar Rights
102
+ that applies to Your use of the Licensed Material.
103
+
104
+ f. Licensed Material means the artistic or literary work, database,
105
+ or other material to which the Licensor applied this Public
106
+ License.
107
+
108
+ g. Licensed Rights means the rights granted to You subject to the
109
+ terms and conditions of this Public License, which are limited to
110
+ all Copyright and Similar Rights that apply to Your use of the
111
+ Licensed Material and that the Licensor has authority to license.
112
+
113
+ h. Licensor means the individual(s) or entity(ies) granting rights
114
+ under this Public License.
115
+
116
+ i. NonCommercial means not primarily intended for or directed towards
117
+ commercial advantage or monetary compensation. For purposes of
118
+ this Public License, the exchange of the Licensed Material for
119
+ other material subject to Copyright and Similar Rights by digital
120
+ file-sharing or similar means is NonCommercial provided there is
121
+ no payment of monetary compensation in connection with the
122
+ exchange.
123
+
124
+ j. Share means to provide material to the public by any means or
125
+ process that requires permission under the Licensed Rights, such
126
+ as reproduction, public display, public performance, distribution,
127
+ dissemination, communication, or importation, and to make material
128
+ available to the public including in ways that members of the
129
+ public may access the material from a place and at a time
130
+ individually chosen by them.
131
+
132
+ k. Sui Generis Database Rights means rights other than copyright
133
+ resulting from Directive 96/9/EC of the European Parliament and of
134
+ the Council of 11 March 1996 on the legal protection of databases,
135
+ as amended and/or succeeded, as well as other essentially
136
+ equivalent rights anywhere in the world.
137
+
138
+ l. You means the individual or entity exercising the Licensed Rights
139
+ under this Public License. Your has a corresponding meaning.
140
+
141
+
142
+ Section 2 -- Scope.
143
+
144
+ a. License grant.
145
+
146
+ 1. Subject to the terms and conditions of this Public License,
147
+ the Licensor hereby grants You a worldwide, royalty-free,
148
+ non-sublicensable, non-exclusive, irrevocable license to
149
+ exercise the Licensed Rights in the Licensed Material to:
150
+
151
+ a. reproduce and Share the Licensed Material, in whole or
152
+ in part, for NonCommercial purposes only; and
153
+
154
+ b. produce, reproduce, and Share Adapted Material for
155
+ NonCommercial purposes only.
156
+
157
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
158
+ Exceptions and Limitations apply to Your use, this Public
159
+ License does not apply, and You do not need to comply with
160
+ its terms and conditions.
161
+
162
+ 3. Term. The term of this Public License is specified in Section
163
+ 6(a).
164
+
165
+ 4. Media and formats; technical modifications allowed. The
166
+ Licensor authorizes You to exercise the Licensed Rights in
167
+ all media and formats whether now known or hereafter created,
168
+ and to make technical modifications necessary to do so. The
169
+ Licensor waives and/or agrees not to assert any right or
170
+ authority to forbid You from making technical modifications
171
+ necessary to exercise the Licensed Rights, including
172
+ technical modifications necessary to circumvent Effective
173
+ Technological Measures. For purposes of this Public License,
174
+ simply making modifications authorized by this Section 2(a)
175
+ (4) never produces Adapted Material.
176
+
177
+ 5. Downstream recipients.
178
+
179
+ a. Offer from the Licensor -- Licensed Material. Every
180
+ recipient of the Licensed Material automatically
181
+ receives an offer from the Licensor to exercise the
182
+ Licensed Rights under the terms and conditions of this
183
+ Public License.
184
+
185
+ b. No downstream restrictions. You may not offer or impose
186
+ any additional or different terms or conditions on, or
187
+ apply any Effective Technological Measures to, the
188
+ Licensed Material if doing so restricts exercise of the
189
+ Licensed Rights by any recipient of the Licensed
190
+ Material.
191
+
192
+ 6. No endorsement. Nothing in this Public License constitutes or
193
+ may be construed as permission to assert or imply that You
194
+ are, or that Your use of the Licensed Material is, connected
195
+ with, or sponsored, endorsed, or granted official status by,
196
+ the Licensor or others designated to receive attribution as
197
+ provided in Section 3(a)(1)(A)(i).
198
+
199
+ b. Other rights.
200
+
201
+ 1. Moral rights, such as the right of integrity, are not
202
+ licensed under this Public License, nor are publicity,
203
+ privacy, and/or other similar personality rights; however, to
204
+ the extent possible, the Licensor waives and/or agrees not to
205
+ assert any such rights held by the Licensor to the limited
206
+ extent necessary to allow You to exercise the Licensed
207
+ Rights, but not otherwise.
208
+
209
+ 2. Patent and trademark rights are not licensed under this
210
+ Public License.
211
+
212
+ 3. To the extent possible, the Licensor waives any right to
213
+ collect royalties from You for the exercise of the Licensed
214
+ Rights, whether directly or through a collecting society
215
+ under any voluntary or waivable statutory or compulsory
216
+ licensing scheme. In all other cases the Licensor expressly
217
+ reserves any right to collect such royalties, including when
218
+ the Licensed Material is used other than for NonCommercial
219
+ purposes.
220
+
221
+
222
+ Section 3 -- License Conditions.
223
+
224
+ Your exercise of the Licensed Rights is expressly made subject to the
225
+ following conditions.
226
+
227
+ a. Attribution.
228
+
229
+ 1. If You Share the Licensed Material (including in modified
230
+ form), You must:
231
+
232
+ a. retain the following if it is supplied by the Licensor
233
+ with the Licensed Material:
234
+
235
+ i. identification of the creator(s) of the Licensed
236
+ Material and any others designated to receive
237
+ attribution, in any reasonable manner requested by
238
+ the Licensor (including by pseudonym if
239
+ designated);
240
+
241
+ ii. a copyright notice;
242
+
243
+ iii. a notice that refers to this Public License;
244
+
245
+ iv. a notice that refers to the disclaimer of
246
+ warranties;
247
+
248
+ v. a URI or hyperlink to the Licensed Material to the
249
+ extent reasonably practicable;
250
+
251
+ b. indicate if You modified the Licensed Material and
252
+ retain an indication of any previous modifications; and
253
+
254
+ c. indicate the Licensed Material is licensed under this
255
+ Public License, and include the text of, or the URI or
256
+ hyperlink to, this Public License.
257
+
258
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
259
+ reasonable manner based on the medium, means, and context in
260
+ which You Share the Licensed Material. For example, it may be
261
+ reasonable to satisfy the conditions by providing a URI or
262
+ hyperlink to a resource that includes the required
263
+ information.
264
+
265
+ 3. If requested by the Licensor, You must remove any of the
266
+ information required by Section 3(a)(1)(A) to the extent
267
+ reasonably practicable.
268
+
269
+ 4. If You Share Adapted Material You produce, the Adapter's
270
+ License You apply must not prevent recipients of the Adapted
271
+ Material from complying with this Public License.
272
+
273
+
274
+ Section 4 -- Sui Generis Database Rights.
275
+
276
+ Where the Licensed Rights include Sui Generis Database Rights that
277
+ apply to Your use of the Licensed Material:
278
+
279
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
280
+ to extract, reuse, reproduce, and Share all or a substantial
281
+ portion of the contents of the database for NonCommercial purposes
282
+ only;
283
+
284
+ b. if You include all or a substantial portion of the database
285
+ contents in a database in which You have Sui Generis Database
286
+ Rights, then the database in which You have Sui Generis Database
287
+ Rights (but not its individual contents) is Adapted Material; and
288
+
289
+ c. You must comply with the conditions in Section 3(a) if You Share
290
+ all or a substantial portion of the contents of the database.
291
+
292
+ For the avoidance of doubt, this Section 4 supplements and does not
293
+ replace Your obligations under this Public License where the Licensed
294
+ Rights include other Copyright and Similar Rights.
295
+
296
+
297
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
298
+
299
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
300
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
301
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
302
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
303
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
304
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
305
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
306
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
307
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
308
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
309
+
310
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
311
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
312
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
313
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
314
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
315
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
316
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
317
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
318
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
319
+
320
+ c. The disclaimer of warranties and limitation of liability provided
321
+ above shall be interpreted in a manner that, to the extent
322
+ possible, most closely approximates an absolute disclaimer and
323
+ waiver of all liability.
324
+
325
+
326
+ Section 6 -- Term and Termination.
327
+
328
+ a. This Public License applies for the term of the Copyright and
329
+ Similar Rights licensed here. However, if You fail to comply with
330
+ this Public License, then Your rights under this Public License
331
+ terminate automatically.
332
+
333
+ b. Where Your right to use the Licensed Material has terminated under
334
+ Section 6(a), it reinstates:
335
+
336
+ 1. automatically as of the date the violation is cured, provided
337
+ it is cured within 30 days of Your discovery of the
338
+ violation; or
339
+
340
+ 2. upon express reinstatement by the Licensor.
341
+
342
+ For the avoidance of doubt, this Section 6(b) does not affect any
343
+ right the Licensor may have to seek remedies for Your violations
344
+ of this Public License.
345
+
346
+ c. For the avoidance of doubt, the Licensor may also offer the
347
+ Licensed Material under separate terms or conditions or stop
348
+ distributing the Licensed Material at any time; however, doing so
349
+ will not terminate this Public License.
350
+
351
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
352
+ License.
353
+
354
+
355
+ Section 7 -- Other Terms and Conditions.
356
+
357
+ a. The Licensor shall not be bound by any additional or different
358
+ terms or conditions communicated by You unless expressly agreed.
359
+
360
+ b. Any arrangements, understandings, or agreements regarding the
361
+ Licensed Material not stated herein are separate from and
362
+ independent of the terms and conditions of this Public License.
363
+
364
+
365
+ Section 8 -- Interpretation.
366
+
367
+ a. For the avoidance of doubt, this Public License does not, and
368
+ shall not be interpreted to, reduce, limit, restrict, or impose
369
+ conditions on any use of the Licensed Material that could lawfully
370
+ be made without permission under this Public License.
371
+
372
+ b. To the extent possible, if any provision of this Public License is
373
+ deemed unenforceable, it shall be automatically reformed to the
374
+ minimum extent necessary to make it enforceable. If the provision
375
+ cannot be reformed, it shall be severed from this Public License
376
+ without affecting the enforceability of the remaining terms and
377
+ conditions.
378
+
379
+ c. No term or condition of this Public License will be waived and no
380
+ failure to comply consented to unless expressly agreed to by the
381
+ Licensor.
382
+
383
+ d. Nothing in this Public License constitutes or may be interpreted
384
+ as a limitation upon, or waiver of, any privileges and immunities
385
+ that apply to the Licensor or You, including from the legal
386
+ processes of any jurisdiction or authority.
387
+
388
+ =======================================================================
389
+
390
+ Creative Commons is not a party to its public
391
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
392
+ its public licenses to material it publishes and in those instances
393
+ will be considered the “Licensor.” The text of the Creative Commons
394
+ public licenses is dedicated to the public domain under the CC0 Public
395
+ Domain Dedication. Except for the limited purpose of indicating that
396
+ material is shared under a Creative Commons public license or as
397
+ otherwise permitted by the Creative Commons policies published at
398
+ creativecommons.org/policies, Creative Commons does not authorize the
399
+ use of the trademark "Creative Commons" or any other trademark or logo
400
+ of Creative Commons without its prior written consent including,
401
+ without limitation, in connection with any unauthorized modifications
402
+ to any of its public licenses or any other arrangements,
403
+ understandings, or agreements concerning use of licensed material. For
404
+ the avoidance of doubt, this paragraph does not form part of the
405
+ public licenses.
406
+
407
+ Creative Commons may be contacted at creativecommons.org.
load_dataset.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """按发布格式读取 MERU-ImageNet-1M 的只读内存映射。"""
2
+
3
+ import argparse
4
+ import json
5
+ from pathlib import Path
6
+
7
+ import numpy as np
8
+
9
+
10
+ def load_benchmark(root="."):
11
+ """核对文件长度并返回库向量、查询与前十近邻真值。"""
12
+ root = Path(root)
13
+ metadata = json.loads((root / "mapping.json").read_text(encoding="utf-8"))
14
+ dimensions = metadata["dimensions"]
15
+ counts = {
16
+ "documents": metadata["base_count"],
17
+ "queries": metadata["query_count"],
18
+ "tuning_queries": metadata["tuning_count"],
19
+ }
20
+ layouts = {
21
+ name: (name + ".f32", "<f4", (count, dimensions))
22
+ for name, count in counts.items()
23
+ }
24
+ layouts["truth"] = ("truth.u64", "<u8", (counts["queries"], 10))
25
+ layouts["tuning_truth"] = (
26
+ "tuning_truth.u64", "<u8", (counts["tuning_queries"], 10)
27
+ )
28
+ arrays = {}
29
+ for name, (filename, dtype, shape) in layouts.items():
30
+ path = root / filename
31
+ expected = int(np.prod(shape)) * np.dtype(dtype).itemsize
32
+ if path.stat().st_size != expected:
33
+ raise ValueError(f"文件长度与发布格式不符,文件 {filename}")
34
+ arrays[name] = np.memmap(path, mode="r", dtype=dtype, shape=shape)
35
+ return arrays
36
+
37
+
38
+ if __name__ == "__main__":
39
+ parser = argparse.ArgumentParser(description=__doc__)
40
+ parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parent)
41
+ arguments = parser.parse_args()
42
+ for name, array in load_benchmark(arguments.root).items():
43
+ print(f"已读取 {name},形状 {array.shape},数据类型 {array.dtype}")
mapping.json ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "seed": 20261114,
3
+ "base_count": 1000000,
4
+ "query_count": 10000,
5
+ "tuning_count": 2000,
6
+ "dimensions": 512,
7
+ "model": "MERU ViT-small",
8
+ "checkpoint_sha256": "4466c04a790d9b5974928e7e9e528cbff2d82348f596e60443a88934b9a61de6",
9
+ "repository_commit": "6d4430055f58354539f68668175135256f99d47f",
10
+ "precision": "FP32,关闭 TF32",
11
+ "batch_size": 128,
12
+ "decode_workers": 8,
13
+ "source": "ImageNet ILSVRC2012,服务器只读公共盘",
14
+ "canonical_curvature": -1.0,
15
+ "deduplication": "图像 ID、原始图像 SHA256、规范坐标 FP32 字节 SHA256 全局去重",
16
+ "selection": "完整训练归档编码并全局去重后,固定种子抽取一百万条库向量。独立验证归档去重后抽取一万条测试查询和两千条调参查询。",
17
+ "source_train": [
18
+ "ILSVRC2012_img_train.tar",
19
+ "1d675b47d978889d74fa0da5fadfb00e"
20
+ ],
21
+ "source_val": [
22
+ "ILSVRC2012_img_val.tar",
23
+ "29b22e2961454d5413ddabcf34fc5622"
24
+ ],
25
+ "original_curvature_parameter": 0.10000000149011612,
26
+ "created_utc_epoch": 1794618176.9924693,
27
+ "files": {
28
+ "documents.f32": {
29
+ "bytes": 2048000000,
30
+ "sha256": "850cbf75c0b3d9f02cd0aace724270fd53e5935209c0bb74690671a3602d9d9d"
31
+ },
32
+ "documents_manifest.jsonl.gz": {
33
+ "bytes": 147340702,
34
+ "sha256": "bf177a85ad6ad757b27e071e3cb8805e4a43e68866a97195c89a2b9f7c5fe8f9"
35
+ },
36
+ "documents_model_spatial.f32": {
37
+ "bytes": 2048000000,
38
+ "sha256": "b3b5e1df4a4ed6da59aa5937cacb4d351617c055ccfa7ce657b049f1d47cc58c"
39
+ },
40
+ "queries.f32": {
41
+ "bytes": 20480000,
42
+ "sha256": "94a3f4d8bc64e2a1e8920a323520c2f781fa687e4aa69d29e646b35d83a78e97"
43
+ },
44
+ "queries_manifest.jsonl.gz": {
45
+ "bytes": 1260958,
46
+ "sha256": "c666cac67b152fd4bc62f2d0c17bb914e9de9f8ecd401c394e7d3822b060d906"
47
+ },
48
+ "queries_model_spatial.f32": {
49
+ "bytes": 20480000,
50
+ "sha256": "893ee28f1627f15b80569b41e0aa5ddc244e222dd3f819d67cefbb9c1afbe981"
51
+ },
52
+ "queries_top100.u64": {
53
+ "bytes": 8000000,
54
+ "sha256": "d98425d52f8eb909262043681c322f6a1cebe53e9b02ea079cc2901b93e8fcfb"
55
+ },
56
+ "queries_top100_distances.f64": {
57
+ "bytes": 8000000,
58
+ "sha256": "467f0344674a08c0443e10f145481a94370f5c2ee7c1b32735d52508984d1fe0"
59
+ },
60
+ "splits_complete.json": {
61
+ "bytes": 25851,
62
+ "sha256": "ef6b59b30fe945bb2e57ef58dfcac400ae8cbd7804e8f39b2110cac08ee01611"
63
+ },
64
+ "truth.u64": {
65
+ "bytes": 800000,
66
+ "sha256": "29f8527da3f0a19167cd4c0a08c659cd7cce178daabb02a887b5cbf96ae0de0d"
67
+ },
68
+ "truth_complete.json": {
69
+ "bytes": 331,
70
+ "sha256": "c8b74bd19555662f2fc2562f0816041a52e2cc554fe5d2bb734668d47f1d503f"
71
+ },
72
+ "tuning_queries.f32": {
73
+ "bytes": 4096000,
74
+ "sha256": "3fd4402ad74df5bd28afba4a1cf34b68aaa896950965b29f8cc788ecf44d21f1"
75
+ },
76
+ "tuning_queries_manifest.jsonl.gz": {
77
+ "bytes": 252507,
78
+ "sha256": "4e0b6abfad81abd9de652acf93081a138940b407cf667e7f8e342b946d46cf38"
79
+ },
80
+ "tuning_queries_model_spatial.f32": {
81
+ "bytes": 4096000,
82
+ "sha256": "c1360a715564e5d72480843467173a520de91c3231cd178c5d6f970f7cda5d77"
83
+ },
84
+ "tuning_queries_top100.u64": {
85
+ "bytes": 1600000,
86
+ "sha256": "d5882665541c5fa02297f0da995d078b1a2814554ce9170f05c33cbcae6ddd86"
87
+ },
88
+ "tuning_queries_top100_distances.f64": {
89
+ "bytes": 1600000,
90
+ "sha256": "caad600d70162c774146742d264f28b432831ff04660daa6536bba9030fbea91"
91
+ },
92
+ "tuning_truth.u64": {
93
+ "bytes": 160000,
94
+ "sha256": "bd3cf4c7fd1ce2ef7b039d41e1a2c344708aff76ea66aee91e65ee067fa0bb7e"
95
+ },
96
+ "verification.json": {
97
+ "bytes": 385,
98
+ "sha256": "cbd0266b3c1284c60df2b42caebcffd4657919a6f57086789d885ab2b72aa535"
99
+ }
100
+ },
101
+ "curation": {
102
+ "train": {
103
+ "parts": 1000,
104
+ "available": 1281167,
105
+ "accepted": 1275220,
106
+ "excluded": 5947
107
+ },
108
+ "val": {
109
+ "parts": 1,
110
+ "available": 50000,
111
+ "accepted": 49174,
112
+ "excluded": 826
113
+ }
114
+ },
115
+ "sources": {
116
+ "train": {
117
+ "path": "/root/autodl-pub/ImageNet/ILSVRC2012/ILSVRC2012_img_train.tar",
118
+ "bytes": 147897477120,
119
+ "mtime_ns": 1704442105185746839,
120
+ "md5": "1d675b47d978889d74fa0da5fadfb00e",
121
+ "seconds": 1968.0718644559383
122
+ },
123
+ "val": {
124
+ "path": "/root/autodl-pub/ImageNet/ILSVRC2012/ILSVRC2012_img_val.tar",
125
+ "bytes": 6744924160,
126
+ "mtime_ns": 1704441491913926687,
127
+ "md5": "29b22e2961454d5413ddabcf34fc5622",
128
+ "seconds": 59.31244808062911
129
+ }
130
+ },
131
+ "versions": {
132
+ "torch": "2.8.0+cu128",
133
+ "torchvision": "0.23.0+cu128",
134
+ "timm": "0.9.16",
135
+ "Pillow": "11.3.0",
136
+ "numpy": "2.3.2"
137
+ },
138
+ "scripts_sha256": {
139
+ "build_imagenet.py": "26b2be6be326c3b217ba17fef7b89311f9cd4d1aefc252df36a646f82be4c40e",
140
+ "dataset_common.py": "9eb69e56f3e9ce211dcdcb86ffca16d11e81440d0d98c922911a5f61c623ce35"
141
+ },
142
+ "original_distance_from_canonical": "原始曲率距离等于规范曲率距离除以原始曲率参数的平方根"
143
+ }
provenance/data_audit.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "完成": true,
3
+ "文件指纹校验": {
4
+ "完成": true,
5
+ "清单SHA256": "26ea929d21c539590c20963afd430716f20ced51960f75c72cdb5db1c34cbe30",
6
+ "已校验文件数": 18,
7
+ "总字节": 4314192734,
8
+ "源码版本一致": true
9
+ },
10
+ "向量检查": {
11
+ "documents": {
12
+ "形状": [
13
+ 1000000,
14
+ 512
15
+ ],
16
+ "有限值": true,
17
+ "全部位于球内": true,
18
+ "半径最小值": 0.11673327310289958,
19
+ "半径最大值": 0.13501184398047403,
20
+ "坐标转换最大绝对误差": 1.8626443235025825e-09
21
+ },
22
+ "queries": {
23
+ "形状": [
24
+ 10000,
25
+ 512
26
+ ],
27
+ "有限值": true,
28
+ "全部位于球内": true,
29
+ "半径最小值": 0.1182835436163339,
30
+ "半径最大值": 0.13347441244527922,
31
+ "坐标转换最大绝对误差": 1.8625257725002342e-09
32
+ },
33
+ "tuning_queries": {
34
+ "形状": [
35
+ 2000,
36
+ 512
37
+ ],
38
+ "有限值": true,
39
+ "全部位于球内": true,
40
+ "半径最小值": 0.12039385023460057,
41
+ "半径最大值": 0.13291410828109335,
42
+ "坐标转换最大绝对误差": 1.8614993713139683e-09
43
+ }
44
+ },
45
+ "真值检查": {
46
+ "queries": {
47
+ "查询数": 10000,
48
+ "top100标识范围及去重": true,
49
+ "距离升序": true,
50
+ "top10一致": true,
51
+ "独立重算距离条目数": 12800,
52
+ "最大绝对距离误差": 3.975986206938842e-15,
53
+ "最小近邻距离": 0.014890379516576666
54
+ },
55
+ "tuning_queries": {
56
+ "查询数": 2000,
57
+ "top100标识范围及去重": true,
58
+ "距离升序": true,
59
+ "top10一致": true,
60
+ "独立重算距离条目数": 12800,
61
+ "最大绝对距离误差": 2.6367796834847468e-15,
62
+ "最小近邻距离": 0.03134619947021426
63
+ }
64
+ }
65
+ }
provenance/encoding_config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "seed": 20261114,
3
+ "base_count": 1000000,
4
+ "query_count": 10000,
5
+ "tuning_count": 2000,
6
+ "dimensions": 512,
7
+ "model": "MERU ViT-small",
8
+ "checkpoint_sha256": "4466c04a790d9b5974928e7e9e528cbff2d82348f596e60443a88934b9a61de6",
9
+ "repository_commit": "6d4430055f58354539f68668175135256f99d47f",
10
+ "precision": "FP32,关闭 TF32",
11
+ "batch_size": 128,
12
+ "decode_workers": 8,
13
+ "source": "ImageNet ILSVRC2012,服务器只读公共盘",
14
+ "canonical_curvature": -1.0,
15
+ "deduplication": "图像 ID、原始图像 SHA256、规范坐标 FP32 字节 SHA256 全局去重",
16
+ "selection": "完整训练归档编码并全局去重后,固定种子抽取一百万条库向量。独立验证归档去重后抽取一万条测试查询和两千条调参查询。",
17
+ "source_train": [
18
+ "ILSVRC2012_img_train.tar",
19
+ "1d675b47d978889d74fa0da5fadfb00e"
20
+ ],
21
+ "source_val": [
22
+ "ILSVRC2012_img_val.tar",
23
+ "29b22e2961454d5413ddabcf34fc5622"
24
+ ]
25
+ }
provenance/generation_README.zh.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MERU ImageNet 百万级双曲 ANN 数据集
2
+
3
+ 使用冻结 MERU ViT-small 权重,FP32 编码并关闭 TF32。原始图片来自服务器只读公共盘的完整 ILSVRC2012 训练与验证归档,两个归档均核对 torchvision 公布的官方 MD5。
4
+
5
+ 完整编码并去重后,按固定种子从训练集抽取 1,000,000 条库向量,从验证集抽取 10,000 条测试查询与 2,000 条调参查询。全局去重图像 ID、原始图像 SHA256 和规范向量字节 SHA256。
6
+
7
+ ## 文件
8
+
9
+ - documents.f32、queries.f32、tuning_queries.f32 保存 512 维曲率 −1 单位 Poincaré 球坐标。格式为无头部、小端 FP32、行优先布局。
10
+ - 名称含 model_spatial 的文件保存原始 MERU Lorentz 空间分量。原始曲率参数保存在 mapping.json。
11
+ - truth.u64、tuning_truth.u64 按查询逐行保存前 10 个库行号,使用小端 uint64。
12
+ - 名称含 top100 的文件保存前 100 个库行号和双曲测地距离,分别使用 uint64 与 FP64。
13
+ - 名称含 manifest 的压缩 JSONL 保存行号、图像 ID、原始划分、TAR 成员名、源文件偏移、图像 MD5、图像 SHA256 与向量 SHA256。
14
+ - mapping.json 保存来源、模型指纹、随机种子、格式、软件版本及文件 SHA256。
15
+ - verification.json 保存独立 CPU 直接坐标差全扫描核验及划分无重叠检查结果。
16
+
17
+ ## 重现
18
+
19
+ 上一级 build_imagenet.py 为制作入口,dataset_common.py 为共用编码与真值逻辑。脚本支持按类别断点恢复。公共盘归档只读访问,临时磁盘保存向量与来源清单。
20
+
21
+ ## 来源与使用
22
+
23
+ ImageNet 来自 https://image-net.org/ ,使用和传播需遵循原数据条款。MERU 来自 https://github.com/facebookresearch/meru 。本目录保存派生向量及来源信息。
queries.f32 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94a3f4d8bc64e2a1e8920a323520c2f781fa687e4aa69d29e646b35d83a78e97
3
+ size 20480000
queries_manifest.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c666cac67b152fd4bc62f2d0c17bb914e9de9f8ecd401c394e7d3822b060d906
3
+ size 1260958
queries_model_spatial.f32 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:893ee28f1627f15b80569b41e0aa5ddc244e222dd3f819d67cefbb9c1afbe981
3
+ size 20480000
queries_top100.u64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d98425d52f8eb909262043681c322f6a1cebe53e9b02ea079cc2901b93e8fcfb
3
+ size 8000000
queries_top100_distances.f64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:467f0344674a08c0443e10f145481a94370f5c2ee7c1b32735d52508984d1fe0
3
+ size 8000000
reproduction/README.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Reproducing the published vectors
2
+
3
+ The two Python files in this directory are the original frozen generation scripts. Their hashes match `mapping.json`. The recorded environment uses Linux, an NVIDIA CUDA GPU, PyTorch `2.8.0+cu128`, torchvision `0.23.0+cu128`, timm `0.9.16`, Pillow `11.3.0`, and NumPy `2.3.2`.
4
+
5
+ ## Source inputs
6
+
7
+ Obtain the original ILSVRC2012 training and validation TAR archives through ImageNet's access process. Place both in `/root/autodl-pub/ImageNet/ILSVRC2012`. The preparation entry point checks their official MD5 hashes.
8
+
9
+ Prepare the frozen MERU source and official model checkpoint using the following commands.
10
+
11
+ ```bash
12
+ mkdir -p /root/autodl-tmp/quiver-meru-pilot
13
+ git clone https://github.com/facebookresearch/meru /root/autodl-tmp/quiver-meru-pilot/meru
14
+ git -C /root/autodl-tmp/quiver-meru-pilot/meru checkout 6d4430055f58354539f68668175135256f99d47f
15
+ curl -L https://dl.fbaipublicfiles.com/meru/meru_vit_s.pth -o /root/autodl-tmp/quiver-meru-pilot/meru_vit_s.pth
16
+ ```
17
+
18
+ Install the recorded Python dependencies and MERU's additional dependencies from its frozen source tree. The checkpoint SHA256 must equal `4466c04a790d9b5974928e7e9e528cbff2d82348f596e60443a88934b9a61de6`.
19
+
20
+ ## Generation
21
+
22
+ ```bash
23
+ python reproduction/build_imagenet.py
24
+ ```
25
+
26
+ The generated benchmark is written to `/root/autodl-tmp/quiver-meru-imagenet-1m/dataset`. Encoding can resume from completed class shards. Source images are globally deduplicated by image ID, image SHA256, and canonical-vector SHA256. The entry point encodes the complete training and validation archives, selects the published split sizes, computes exhaustive FP64 top-100 neighbors, and performs an independent sampled CPU full-scan check.
27
+
28
+ The common helper also contains utilities from the earlier dataset-preparation workflow. The `build_imagenet.py` entry point selects ImageNet and the published train/validation selection procedure.
29
+
30
+ Published file hashes identify the exact benchmark release. Floating-point output can depend on the GPU and software environment. The original scripts, metadata, image provenance, and hashes support comparison with a regenerated copy.
reproduction/build_imagenet.py ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """从服务器只读公共盘制作百万级 MERU ImageNet 向量集。"""
2
+
3
+ import concurrent.futures
4
+ import fcntl
5
+ import gzip
6
+ import hashlib
7
+ import json
8
+ import os
9
+ import shutil
10
+ import sys
11
+ import tarfile
12
+ import time
13
+ from pathlib import Path
14
+
15
+ import numpy as np
16
+ import torch
17
+ from torch.utils.data import DataLoader
18
+ from torchvision.datasets.imagenet import ARCHIVE_META
19
+
20
+ import dataset_common as common
21
+
22
+
23
+ ROOT = Path('/root/autodl-tmp/quiver-meru-imagenet-1m')
24
+ SOURCE = Path('/root/autodl-pub/ImageNet/ILSVRC2012')
25
+ SEED = common.SEED
26
+ DIMENSIONS = common.DIMENSIONS
27
+ CONFIG = {
28
+ **common.CONFIG,
29
+ 'source': 'ImageNet ILSVRC2012,服务器只读公共盘',
30
+ 'selection': '完整训练归档编码并全局去重后,固定种子抽取一百万条库向量。独立验证归档去重后抽取一万条测试查询和两千条调参查询。',
31
+ 'source_train': ARCHIVE_META['train'],
32
+ 'source_val': ARCHIVE_META['val'],
33
+ }
34
+
35
+
36
+ def status(stage, **values):
37
+ common.update_status(stage, root=ROOT, **values)
38
+
39
+
40
+ def verify_source(split):
41
+ filename, expected = ARCHIVE_META[split]
42
+ path = SOURCE / filename
43
+ record_path = ROOT / f'source_{split}.json'
44
+ current = {'bytes': path.stat().st_size, 'mtime_ns': path.stat().st_mtime_ns}
45
+ if record_path.exists():
46
+ previous = json.loads(record_path.read_text())
47
+ if previous['bytes'] == current['bytes'] and previous['mtime_ns'] == current['mtime_ns'] and previous['md5'] == expected:
48
+ return previous
49
+ started = time.perf_counter()
50
+ with path.open('rb') as source:
51
+ actual = hashlib.file_digest(source, 'md5').hexdigest()
52
+ if actual != expected:
53
+ raise RuntimeError(f'ImageNet {split} 归档 MD5 与官方值不符')
54
+ result = {'path': str(path), **current, 'md5': actual, 'seconds': time.perf_counter() - started}
55
+ common.atomic_json(record_path, result)
56
+ print('源归档校验通过 ' + json.dumps(result, ensure_ascii=False), flush=True)
57
+ return result
58
+
59
+
60
+ def restore_seen():
61
+ seen = (set(), set(), set())
62
+ totals = {'train': 0, 'val': 0}
63
+ for directory in sorted((ROOT / 'shards').iterdir()):
64
+ if directory.name.endswith('.partial') or not (directory / 'complete.json').exists():
65
+ continue
66
+ metadata = json.loads((directory / 'complete.json').read_text())
67
+ for name in ['spatial.npy', 'samples.jsonl']:
68
+ if common.checksum(directory / name) != metadata['sha256'][name]:
69
+ raise RuntimeError('已保存向量分片校验失败')
70
+ with (directory / 'samples.jsonl').open(encoding='utf-8') as source:
71
+ for line in source:
72
+ record = json.loads(line)
73
+ for key, collection in zip((record['id'], record['image_sha256'], record['vector_sha256']), seen):
74
+ if key in collection:
75
+ raise RuntimeError('已保存分片存在重复记录')
76
+ collection.add(key)
77
+ totals[metadata['split']] += metadata['accepted']
78
+ return seen, totals
79
+
80
+
81
+ def cache_category(category):
82
+ cached = ROOT / 'cache' / category['name']
83
+ if not cached.exists():
84
+ temporary = cached.with_suffix('.partial')
85
+ with (SOURCE / ARCHIVE_META['train'][0]).open('rb') as original, temporary.open('wb') as output:
86
+ original.seek(category['offset'])
87
+ remaining = category['bytes']
88
+ while remaining:
89
+ block = original.read(min(8 * 1024 * 1024, remaining))
90
+ if not block:
91
+ raise RuntimeError('原始类别归档提前结束')
92
+ output.write(block)
93
+ remaining -= len(block)
94
+ temporary.replace(cached)
95
+ if cached.stat().st_size != category['bytes']:
96
+ raise RuntimeError('类别缓存长度不符')
97
+ return cached
98
+
99
+
100
+ @torch.inference_mode()
101
+ def encode_records(model, split, name, archive_path, records, seen):
102
+ destination = ROOT / 'shards' / name
103
+ if (destination / 'complete.json').exists():
104
+ return 0
105
+ started = time.perf_counter()
106
+ loader = DataLoader(common.ArchiveDataset(archive_path, records), batch_size=CONFIG['batch_size'], num_workers=CONFIG['decode_workers'], pin_memory=True, collate_fn=common.collate_images, shuffle=False)
107
+ vectors = np.empty((len(records), DIMENSIONS), dtype='<f4')
108
+ accepted = []
109
+ excluded = []
110
+ curvature = model.curv.exp().item()
111
+ for images, metadata, failures in loader:
112
+ excluded.extend(failures)
113
+ if images is None:
114
+ continue
115
+ features = model.encode_image(images.cuda(non_blocking=True), project=False)
116
+ spatial = common.lorentz.exp_map0(features.float() * model.visual_alpha.exp(), model.curv.exp()).cpu().numpy()
117
+ canonical = common.canonical_coordinates(spatial, curvature)
118
+ if not np.isfinite(spatial).all() or not np.isfinite(canonical).all() or (np.sum(canonical.astype(np.float64) ** 2, axis=1) >= 1).any():
119
+ raise RuntimeError('图像编码或球内约束失败')
120
+ for index, record in enumerate(metadata):
121
+ vector_hash = hashlib.sha256(canonical[index].tobytes()).hexdigest()
122
+ keys = (record['id'], record['image_sha256'], vector_hash)
123
+ if any(key in collection for key, collection in zip(keys, seen)):
124
+ excluded.append({'id': record['id'], 'reason': '重复 ID、图像内容或规范向量'})
125
+ continue
126
+ for key, collection in zip(keys, seen):
127
+ collection.add(key)
128
+ record['vector_sha256'] = vector_hash
129
+ record['source_split'] = split
130
+ vectors[len(accepted)] = spatial[index]
131
+ accepted.append(record)
132
+ temporary = destination.with_suffix('.partial')
133
+ temporary.mkdir(exist_ok=True)
134
+ np.save(temporary / 'spatial.npy', vectors[:len(accepted)])
135
+ with (temporary / 'samples.jsonl').open('w', encoding='utf-8') as output:
136
+ for record in accepted:
137
+ output.write(json.dumps(record, ensure_ascii=False) + '\n')
138
+ output.flush()
139
+ os.fsync(output.fileno())
140
+ common.atomic_json(temporary / 'excluded.json', excluded)
141
+ with (temporary / 'spatial.npy').open('rb') as output:
142
+ os.fsync(output.fileno())
143
+ result = {
144
+ 'split': split,
145
+ 'name': name,
146
+ 'accepted': len(accepted),
147
+ 'excluded': len(excluded),
148
+ 'available': len(records),
149
+ 'seconds': time.perf_counter() - started,
150
+ 'sha256': {
151
+ filename: common.checksum(temporary / filename)
152
+ for filename in ['spatial.npy', 'samples.jsonl']
153
+ },
154
+ }
155
+ common.atomic_json(temporary / 'complete.json', result)
156
+ temporary.rename(destination)
157
+ print('图像分片完成 ' + json.dumps(result, ensure_ascii=False), flush=True)
158
+ return len(accepted)
159
+
160
+
161
+ def encode_sources(model):
162
+ seen, totals = restore_seen()
163
+ archive_path = SOURCE / ARCHIVE_META['train'][0]
164
+ index_path = ROOT / 'source_index.json'
165
+ if index_path.exists():
166
+ classes = json.loads(index_path.read_text())
167
+ else:
168
+ status('索引 ImageNet 类别归档', **totals)
169
+ with tarfile.open(archive_path, 'r:') as archive:
170
+ classes = [{'name': member.name, 'offset': member.offset_data, 'bytes': member.size} for member in archive if member.isfile() and member.name.endswith('.tar')]
171
+ classes.sort(key=lambda member: member['name'])
172
+ common.atomic_json(index_path, classes)
173
+ if len(classes) != 1000:
174
+ raise RuntimeError('ImageNet 训练归档类别数不符')
175
+ cache = ROOT / 'cache'
176
+ cache.mkdir(exist_ok=True)
177
+ pending = [
178
+ (position, category)
179
+ for position, category in enumerate(classes)
180
+ if not (ROOT / 'shards' / ('train_' + Path(category['name']).stem) / 'complete.json').exists()
181
+ ]
182
+ with concurrent.futures.ThreadPoolExecutor(max_workers=2) as pool:
183
+ futures = {}
184
+ for current, (position, category) in enumerate(pending):
185
+ for _, next_category in pending[current:current + 2]:
186
+ if next_category['name'] not in futures:
187
+ futures[next_category['name']] = pool.submit(cache_category, next_category)
188
+ cached = futures.pop(category['name']).result()
189
+ name = 'train_' + Path(category['name']).stem
190
+ records = []
191
+ with tarfile.open(cached, mode='r:') as inner:
192
+ for image in inner:
193
+ if image.isfile():
194
+ records.append({'id': Path(image.name).stem, 'class': Path(category['name']).stem, 'member': category['name'] + '/' + image.name, 'offset': image.offset_data, 'source_offset': category['offset'] + image.offset_data, 'bytes': image.size})
195
+ records.sort(key=lambda record: record['id'])
196
+ totals['train'] += encode_records(model, 'train', name, cached, records, seen)
197
+ cached.unlink()
198
+ status('编码 ImageNet 训练集', completed_classes=position + 1, total_classes=1000, **totals)
199
+ archive_path = SOURCE / ARCHIVE_META['val'][0]
200
+ if not (ROOT / 'shards' / 'val' / 'complete.json').exists():
201
+ cached = cache / archive_path.name
202
+ if not cached.exists():
203
+ temporary = cached.with_suffix('.partial')
204
+ with archive_path.open('rb') as source, temporary.open('wb') as output:
205
+ shutil.copyfileobj(source, output, 8 * 1024 * 1024)
206
+ temporary.replace(cached)
207
+ if cached.stat().st_size != archive_path.stat().st_size:
208
+ raise RuntimeError('验证归档缓存长度不符')
209
+ with tarfile.open(cached, 'r:') as archive:
210
+ records = [{'id': Path(member.name).stem, 'member': member.name, 'offset': member.offset_data, 'bytes': member.size} for member in archive if member.isfile()]
211
+ if len(records) != 50000:
212
+ raise RuntimeError('ImageNet 验证归档图像数不符')
213
+ records.sort(key=lambda record: record['id'])
214
+ status('编码 ImageNet 验证集', **totals)
215
+ totals['val'] += encode_records(model, 'val', 'val', cached, records, seen)
216
+ cached.unlink()
217
+ status('编码完成,准备划分', **totals)
218
+
219
+
220
+ def make_splits(curvature):
221
+ destination = ROOT / 'dataset'
222
+ destination.mkdir(exist_ok=True)
223
+ if (destination / 'splits_complete.json').exists():
224
+ return
225
+ pools = {}
226
+ for split, pattern in [('train', 'train_*'), ('val', 'val')]:
227
+ directories = sorted(directory for directory in (ROOT / 'shards').glob(pattern) if not directory.name.endswith('.partial') and (directory / 'complete.json').exists())
228
+ blocks = []
229
+ records = []
230
+ for directory in directories:
231
+ blocks.append(np.load(directory / 'spatial.npy'))
232
+ with (directory / 'samples.jsonl').open(encoding='utf-8') as source:
233
+ records.extend(json.loads(line) for line in source)
234
+ pools[split] = (np.concatenate(blocks), records)
235
+ if len(pools['train'][0]) < common.BASE_COUNT or len(pools['val'][0]) < common.QUERY_COUNT + common.TUNING_COUNT:
236
+ raise RuntimeError('去重后样本数量不足')
237
+ rng = np.random.default_rng(SEED + 1)
238
+ train_rows = rng.permutation(len(pools['train'][0]))[:common.BASE_COUNT]
239
+ val_rows = rng.permutation(len(pools['val'][0]))[:common.QUERY_COUNT + common.TUNING_COUNT]
240
+ splits = [('documents', 'train', train_rows), ('queries', 'val', val_rows[:common.QUERY_COUNT]), ('tuning_queries', 'val', val_rows[common.QUERY_COUNT:])]
241
+ statistics = {}
242
+ for name, source_split, indices in splits:
243
+ vectors, records = pools[source_split]
244
+ spatial = np.memmap(destination / f'{name}_model_spatial.f32', dtype='<f4', mode='w+', shape=(len(indices), DIMENSIONS))
245
+ canonical = np.memmap(destination / f'{name}.f32', dtype='<f4', mode='w+', shape=(len(indices), DIMENSIONS))
246
+ radii = []
247
+ categories = {}
248
+ with gzip.open(destination / f'{name}_manifest.jsonl.gz', 'wt', encoding='utf-8') as output:
249
+ for start in range(0, len(indices), 4096):
250
+ rows = indices[start:start + 4096]
251
+ block = vectors[rows]
252
+ mapped = common.canonical_coordinates(block, curvature)
253
+ spatial[start:start + len(rows)] = block
254
+ canonical[start:start + len(rows)] = mapped
255
+ radii.append(np.linalg.norm(mapped.astype(np.float64), axis=1))
256
+ for local, original_row in enumerate(rows):
257
+ record = records[int(original_row)]
258
+ if hashlib.sha256(mapped[local].tobytes()).hexdigest() != record['vector_sha256']:
259
+ raise RuntimeError('最终坐标指纹与编码分片不符')
260
+ output.write(json.dumps({'row': start + local, **record}, ensure_ascii=False) + '\n')
261
+ if 'class' in record:
262
+ categories[record['class']] = categories.get(record['class'], 0) + 1
263
+ spatial.flush()
264
+ canonical.flush()
265
+ for path in [destination / f'{name}.f32', destination / f'{name}_model_spatial.f32']:
266
+ with path.open('rb') as output:
267
+ os.fsync(output.fileno())
268
+ radii = np.concatenate(radii)
269
+ statistics[name] = {
270
+ 'count': len(indices),
271
+ 'source_split': source_split,
272
+ 'radius_quantiles': np.quantile(radii, [0, .01, .1, .5, .9, .99, 1]).tolist(),
273
+ 'finite': bool(np.isfinite(canonical).all()),
274
+ 'inside_ball': bool((radii < 1).all()),
275
+ 'class_counts': categories,
276
+ }
277
+ if not statistics[name]['finite'] or not statistics[name]['inside_ball']:
278
+ raise RuntimeError('最终向量有效性检查失败')
279
+ common.atomic_json(destination / 'splits_complete.json', statistics)
280
+
281
+
282
+ def finalize(curvature):
283
+ destination = ROOT / 'dataset'
284
+ curation = {split: {'parts': 0, 'available': 0, 'accepted': 0, 'excluded': 0} for split in ['train', 'val']}
285
+ for directory in (ROOT / 'shards').iterdir():
286
+ if directory.name.endswith('.partial') or not (directory / 'complete.json').exists():
287
+ continue
288
+ record = json.loads((directory / 'complete.json').read_text())
289
+ current = curation[record['split']]
290
+ current['parts'] += 1
291
+ for key in ['available', 'accepted', 'excluded']:
292
+ current[key] += record[key]
293
+ files = {
294
+ path.name: {'bytes': path.stat().st_size, 'sha256': common.checksum(path)}
295
+ for path in sorted(destination.iterdir())
296
+ if path.is_file() and path.name not in ['mapping.json', 'README.md']
297
+ }
298
+ metadata = {
299
+ **CONFIG,
300
+ 'original_curvature_parameter': curvature,
301
+ 'created_utc_epoch': time.time(),
302
+ 'files': files,
303
+ 'curation': curation,
304
+ 'sources': {
305
+ name: json.loads((ROOT / f'source_{name}.json').read_text())
306
+ for name in ['train', 'val']
307
+ },
308
+ 'versions': {
309
+ name: common.importlib.metadata.version(name)
310
+ for name in ['torch', 'torchvision', 'timm', 'Pillow', 'numpy']
311
+ },
312
+ 'scripts_sha256': {
313
+ name: common.checksum(ROOT / name)
314
+ for name in ['build_imagenet.py', 'dataset_common.py']
315
+ },
316
+ 'original_distance_from_canonical': '原始曲率距离等于规范曲率距离除以原始曲率参数的平方根',
317
+ }
318
+ common.atomic_json(destination / 'mapping.json', metadata)
319
+ readme = '''# MERU ImageNet 百万级双曲 ANN 数据集
320
+
321
+ 使用冻结 MERU ViT-small 权重,FP32 编码并关闭 TF32。原始图片来自服务器只读公共盘的完整 ILSVRC2012 训练与验证归档,两个归档均核对 torchvision 公布的官方 MD5。
322
+
323
+ 完整编码并去重后,按固定种子从训练集抽取 1,000,000 条库向量,从验证集抽取 10,000 条测试查询与 2,000 条调参查询。全局去重图像 ID、原始图像 SHA256 和规范向量字节 SHA256。
324
+
325
+ ## 文件
326
+
327
+ - documents.f32、queries.f32、tuning_queries.f32 保存 512 维曲率 −1 单位 Poincaré 球坐标。格式为无头部、小端 FP32、行优先布局。
328
+ - 名称含 model_spatial 的文件保存原始 MERU Lorentz 空间分量。原始曲率参数保存在 mapping.json。
329
+ - truth.u64、tuning_truth.u64 按查询逐行保存前 10 个库行号,使用小端 uint64。
330
+ - 名称含 top100 的文件保存前 100 个库行号和双曲测地距离,分别使用 uint64 与 FP64。
331
+ - 名称含 manifest 的压缩 JSONL 保存行号、图像 ID、原始划分、TAR 成员名、源文件偏移、图像 MD5、图像 SHA256 与向量 SHA256。
332
+ - mapping.json 保存来源、模型指纹、随机种子、格式、软件版本及文件 SHA256。
333
+ - verification.json 保存独立 CPU 直接坐标差全扫描核验及划分无重叠检查结果。
334
+
335
+ ## 重现
336
+
337
+ 上一级 build_imagenet.py 为制作入口,dataset_common.py 为共用编码与真值逻辑。脚本支持按类别断点恢复。公共盘归档只读访问,临时磁盘保存向量与来源清单。
338
+
339
+ ## 来源与使用
340
+
341
+ ImageNet 来自 https://image-net.org/ ,使用和传播需遵循原数据条款。MERU 来自 https://github.com/facebookresearch/meru 。本目录保存派生向量及来源信息。
342
+ '''
343
+ (destination / 'README.md').write_text(readme, encoding='utf-8')
344
+ common.atomic_json(ROOT / 'complete.json', {'complete': True, 'dataset': str(destination), 'mapping_sha256': common.checksum(destination / 'mapping.json'), 'timestamp': time.time()})
345
+ status('完成', documents=common.BASE_COUNT, queries=common.QUERY_COUNT, tuning_queries=common.TUNING_COUNT)
346
+
347
+
348
+ def main():
349
+ (ROOT / 'shards').mkdir(exist_ok=True)
350
+ config_path = ROOT / 'config.json'
351
+ serialized_config = json.loads(json.dumps(CONFIG))
352
+ if config_path.exists() and json.loads(config_path.read_text()) != serialized_config:
353
+ raise RuntimeError('已有 ImageNet 任务配置不符')
354
+ common.atomic_json(config_path, CONFIG)
355
+ if (ROOT / 'complete.json').exists():
356
+ print('ImageNet 数据集已完成', flush=True)
357
+ return
358
+ torch.set_num_threads(4)
359
+ torch.backends.cuda.matmul.allow_tf32 = False
360
+ torch.backends.cudnn.allow_tf32 = False
361
+ torch.manual_seed(SEED)
362
+ with concurrent.futures.ThreadPoolExecutor(max_workers=2) as pool:
363
+ hashes = [pool.submit(verify_source, split) for split in ['train', 'val']]
364
+ model = common.load_model()
365
+ curvature = model.curv.exp().item()
366
+ encode_sources(model)
367
+ del model
368
+ torch.cuda.empty_cache()
369
+ for future in hashes:
370
+ future.result()
371
+ make_splits(curvature)
372
+ common.compute_truth(root=ROOT)
373
+ common.verify_truth(root=ROOT)
374
+ finalize(curvature)
375
+
376
+
377
+ if __name__ == '__main__':
378
+ ROOT.mkdir(exist_ok=True)
379
+ lock = (ROOT / '.build.lock').open('a')
380
+ try:
381
+ fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
382
+ except BlockingIOError:
383
+ print('已有 ImageNet 制作进程持有任务锁', flush=True)
384
+ sys.exit(1)
385
+ os.register_at_fork(after_in_child=lock.close)
386
+ try:
387
+ main()
388
+ except Exception as error:
389
+ status('失败', error=f'{type(error).__name__} {error}')
390
+ raise
reproduction/dataset_common.py ADDED
@@ -0,0 +1,586 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """下载 GLDv2 分片,制作可恢复的 MERU 图像向量集与精确双曲近邻真值。"""
2
+
3
+ import concurrent.futures
4
+ import fcntl
5
+ import gzip
6
+ import hashlib
7
+ import importlib.metadata
8
+ import io
9
+ import json
10
+ import os
11
+ import random
12
+ import shutil
13
+ import subprocess
14
+ import sys
15
+ import tarfile
16
+ import time
17
+ from pathlib import Path
18
+
19
+ import numpy as np
20
+ import requests
21
+ import torch
22
+ import torchvision.transforms as transforms
23
+ from PIL import Image
24
+ from torch.utils.data import DataLoader, Dataset
25
+
26
+
27
+ ROOT = Path('/root/autodl-tmp/quiver-meru-gldv2-1m')
28
+ PILOT = Path('/root/autodl-tmp/quiver-meru-pilot')
29
+ sys.path.insert(0, str(PILOT / 'meru'))
30
+
31
+ from meru import lorentz
32
+ from meru.encoders.image_encoders import build_timm_vit
33
+ from meru.encoders.text_encoders import TransformerTextEncoder
34
+ from meru.models import MERU
35
+
36
+
37
+ SEED = 20261114
38
+ BASE_COUNT = 1_000_000
39
+ QUERY_COUNT = 10_000
40
+ TUNING_COUNT = 2_000
41
+ TOTAL_COUNT = BASE_COUNT + QUERY_COUNT + TUNING_COUNT
42
+ DIMENSIONS = 512
43
+ DOWNLOAD_BLOCK = 8 * 1024 * 1024
44
+ DOWNLOAD_WORKERS = int(os.environ.get('QUIVER_DOWNLOAD_WORKERS', '16'))
45
+ PREFETCH_SHARDS = int(os.environ.get('QUIVER_PREFETCH_SHARDS', '4'))
46
+ CONFIG = {
47
+ 'seed': SEED,
48
+ 'base_count': BASE_COUNT,
49
+ 'query_count': QUERY_COUNT,
50
+ 'tuning_count': TUNING_COUNT,
51
+ 'dimensions': DIMENSIONS,
52
+ 'model': 'MERU ViT-small',
53
+ 'checkpoint_sha256': '4466c04a790d9b5974928e7e9e528cbff2d82348f596e60443a88934b9a61de6',
54
+ 'repository_commit': '6d4430055f58354539f68668175135256f99d47f',
55
+ 'precision': 'FP32,关闭 TF32',
56
+ 'batch_size': 128,
57
+ 'decode_workers': 8,
58
+ 'source': 'https://s3.amazonaws.com/google-landmark/train/',
59
+ 'canonical_curvature': -1.0,
60
+ 'deduplication': '图像 ID、原始图像 SHA256、规范坐标 FP32 字节 SHA256 全局去重',
61
+ 'selection': '固定种子打乱 500 个分片,依次取有效且去重的图像,再以独立固定种子打乱并划分',
62
+ }
63
+
64
+
65
+ def atomic_json(path, value):
66
+ temporary = path.with_suffix(path.suffix + '.tmp')
67
+ with temporary.open('w', encoding='utf-8') as output:
68
+ json.dump(value, output, ensure_ascii=False, indent=2)
69
+ output.flush()
70
+ os.fsync(output.fileno())
71
+ temporary.replace(path)
72
+
73
+
74
+ def checksum(path):
75
+ digest = hashlib.sha256()
76
+ with path.open('rb') as source:
77
+ while block := source.read(4 * 1024 * 1024):
78
+ digest.update(block)
79
+ return digest.hexdigest()
80
+
81
+
82
+ def update_status(stage, root=ROOT, **values):
83
+ value = {'stage': stage, 'timestamp': time.time(), **values}
84
+ atomic_json(root / 'status.json', value)
85
+ print('数据集进度 ' + json.dumps(value, ensure_ascii=False), flush=True)
86
+
87
+
88
+ def request_metadata(url):
89
+ for attempt in range(8):
90
+ try:
91
+ response = requests.get(url, timeout=(15, 30))
92
+ response.raise_for_status()
93
+ return response
94
+ except requests.RequestException:
95
+ if attempt == 7:
96
+ raise
97
+ time.sleep(min(2 ** attempt, 15))
98
+
99
+
100
+ def download_archive(shard):
101
+ started = time.perf_counter()
102
+ cache = ROOT / 'cache'
103
+ target = cache / f'images_{shard:03d}.tar'
104
+ md5_path = cache / f'images_{shard:03d}.md5'
105
+ url = CONFIG['source'] + target.name
106
+ if not md5_path.exists():
107
+ response = request_metadata(f'https://s3.amazonaws.com/google-landmark/md5sum/train/md5.images_{shard:03d}.txt')
108
+ md5_path.write_bytes(response.content)
109
+ checksums = [line.split() for line in md5_path.read_text().splitlines() if line.strip()]
110
+ if len(checksums) != 1 or Path(checksums[0][1].lstrip('*')).name != target.name:
111
+ raise RuntimeError('官方分片校验格式不符')
112
+ expected_md5 = checksums[0][0]
113
+ if target.exists():
114
+ with target.open('rb') as source:
115
+ if hashlib.file_digest(source, 'md5').hexdigest() != expected_md5:
116
+ raise RuntimeError('已有分片 MD5 校验失败')
117
+ return target, md5_path, {'cached': True, 'bytes': target.stat().st_size, 'seconds': 0, 'official_md5': expected_md5}
118
+
119
+ for attempt in range(8):
120
+ try:
121
+ with requests.get(url, headers={'Range': 'bytes=0-0'}, stream=True, timeout=(15, 30)) as response:
122
+ response.raise_for_status()
123
+ size = int(response.headers['Content-Range'].split('/')[-1])
124
+ break
125
+ except (requests.RequestException, KeyError):
126
+ if attempt == 7:
127
+ raise
128
+ time.sleep(min(2 ** attempt, 15))
129
+
130
+ directory = cache / f'images_{shard:03d}.parts'
131
+ directory.mkdir(exist_ok=True)
132
+
133
+ def fetch(index):
134
+ begin = index * DOWNLOAD_BLOCK
135
+ end = min(size, begin + DOWNLOAD_BLOCK) - 1
136
+ expected = end - begin + 1
137
+ path = directory / f'{index:05d}.part'
138
+ for attempt in range(8):
139
+ current = path.stat().st_size if path.exists() else 0
140
+ if current == expected:
141
+ return
142
+ if current > expected:
143
+ raise RuntimeError('下载分块长度超过预期')
144
+ try:
145
+ offset = begin + current
146
+ with requests.get(url, headers={'Range': f'bytes={offset}-{end}'}, stream=True, timeout=(15, 20)) as response:
147
+ response.raise_for_status()
148
+ actual = response.headers.get('Content-Range')
149
+ if response.status_code != 206 or actual != f'bytes {offset}-{end}/{size}':
150
+ raise RuntimeError(f'分片 {shard} 下载范围错误 {actual}')
151
+ with path.open('ab') as output:
152
+ for block in response.iter_content(256 * 1024):
153
+ output.write(block)
154
+ if path.stat().st_size != expected:
155
+ raise RuntimeError('下载分块长度不足')
156
+ return
157
+ except (requests.RequestException, RuntimeError):
158
+ if attempt == 7:
159
+ raise
160
+ time.sleep(min(2 ** attempt, 15))
161
+
162
+ count = (size + DOWNLOAD_BLOCK - 1) // DOWNLOAD_BLOCK
163
+ with concurrent.futures.ThreadPoolExecutor(max_workers=DOWNLOAD_WORKERS) as pool:
164
+ list(pool.map(fetch, range(count)))
165
+ temporary = target.with_suffix('.tar.partial')
166
+ with temporary.open('wb') as output:
167
+ for index in range(count):
168
+ with (directory / f'{index:05d}.part').open('rb') as source:
169
+ shutil.copyfileobj(source, output, 4 * 1024 * 1024)
170
+ output.flush()
171
+ os.fsync(output.fileno())
172
+ if temporary.stat().st_size != size:
173
+ raise RuntimeError('完整分片长度错误')
174
+ with temporary.open('rb') as source:
175
+ if hashlib.file_digest(source, 'md5').hexdigest() != expected_md5:
176
+ raise RuntimeError('下载分片 MD5 校验失败')
177
+ temporary.replace(target)
178
+ for path in directory.iterdir():
179
+ path.unlink()
180
+ directory.rmdir()
181
+ result = {'cached': False, 'bytes': size, 'seconds': time.perf_counter() - started, 'official_md5': expected_md5}
182
+ print(f'分片下载完成 {shard:03d} ' + json.dumps(result), flush=True)
183
+ return target, md5_path, result
184
+
185
+
186
+ class ArchiveDataset(Dataset):
187
+ def __init__(self, archive, records):
188
+ self.archive = archive
189
+ self.records = records
190
+ self.stream = None
191
+ self.transform = transforms.Compose([
192
+ transforms.Resize(224, interpolation=transforms.InterpolationMode.BICUBIC),
193
+ transforms.CenterCrop(224),
194
+ transforms.ToTensor(),
195
+ ])
196
+
197
+ def __len__(self):
198
+ return len(self.records)
199
+
200
+ def __getitem__(self, index):
201
+ record = self.records[index].copy()
202
+ if self.stream is None:
203
+ self.stream = self.archive.open('rb')
204
+ self.stream.seek(record['offset'])
205
+ content = self.stream.read(record['bytes'])
206
+ if len(content) != record['bytes']:
207
+ raise RuntimeError(f'图像校验失败 {record["id"]}')
208
+ record['md5'] = hashlib.md5(content).hexdigest()
209
+ record['image_sha256'] = hashlib.sha256(content).hexdigest()
210
+ try:
211
+ with Image.open(io.BytesIO(content)) as image:
212
+ tensor = self.transform(image.convert('RGB'))
213
+ return tensor, record, None
214
+ except (OSError, ValueError, Image.DecompressionBombError) as error:
215
+ return None, record, f'{type(error).__name__} {error}'
216
+
217
+
218
+ def collate_images(items):
219
+ valid = [(tensor, record) for tensor, record, error in items if error is None]
220
+ invalid = [{'id': record['id'], 'reason': error} for _, record, error in items if error is not None]
221
+ if not valid:
222
+ return None, [], invalid
223
+ return torch.stack([item[0] for item in valid]), [item[1] for item in valid], invalid
224
+
225
+
226
+ def canonical_coordinates(spatial, curvature):
227
+ scaled = spatial.astype(np.float64) * np.sqrt(curvature)
228
+ time_coordinate = np.sqrt(1 + np.sum(scaled * scaled, axis=1, keepdims=True))
229
+ return np.asarray(scaled / (time_coordinate + 1), dtype='<f4')
230
+
231
+
232
+ def load_model():
233
+ if checksum(PILOT / 'meru_vit_s.pth') != CONFIG['checkpoint_sha256']:
234
+ raise RuntimeError('模型权重校验失败')
235
+ commit = subprocess.check_output(['git', '-C', str(PILOT / 'meru'), 'rev-parse', 'HEAD'], text=True).strip()
236
+ if commit != CONFIG['repository_commit']:
237
+ raise RuntimeError('MERU 源码版本变化')
238
+ model = MERU(
239
+ visual=build_timm_vit('vit_small_mocov3_patch16_224'),
240
+ textual=TransformerTextEncoder('L12_W512', 49408, 77),
241
+ embed_dim=DIMENSIONS,
242
+ entail_weight=0.2,
243
+ )
244
+ checkpoint = torch.load(PILOT / 'meru_vit_s.pth', map_location='cpu', weights_only=False)
245
+ model.load_state_dict(checkpoint['model'], strict=True)
246
+ del checkpoint
247
+ return model.eval().cuda()
248
+
249
+
250
+ @torch.inference_mode()
251
+ def encode_archive(model, shard, source, md5_path, download, remaining, seen):
252
+ started = time.perf_counter()
253
+ records = []
254
+ with tarfile.open(source, mode='r:') as archive:
255
+ for member in archive:
256
+ if member.isfile() and member.name.lower().endswith(('.jpg', '.jpeg', '.png')):
257
+ name = Path(member.name).name
258
+ records.append({'id': Path(name).stem, 'member': member.name, 'offset': member.offset_data, 'bytes': member.size, 'shard': shard})
259
+ if not records:
260
+ raise RuntimeError(f'分片内没有图像 {shard}')
261
+ dataset = ArchiveDataset(source, records)
262
+ loader = DataLoader(dataset, batch_size=CONFIG['batch_size'], num_workers=CONFIG['decode_workers'], pin_memory=True, collate_fn=collate_images, shuffle=False)
263
+ output_vectors = np.empty((min(len(records), remaining), DIMENSIONS), dtype='<f4')
264
+ accepted = []
265
+ excluded = []
266
+ curvature = model.curv.exp().item()
267
+ for images, metadata, failures in loader:
268
+ excluded.extend(failures)
269
+ if images is None:
270
+ continue
271
+ features = model.encode_image(images.cuda(non_blocking=True), project=False)
272
+ spatial = lorentz.exp_map0(features.float() * model.visual_alpha.exp(), model.curv.exp()).cpu().numpy()
273
+ canonical = canonical_coordinates(spatial, curvature)
274
+ if not np.isfinite(canonical).all() or not np.isfinite(spatial).all():
275
+ raise RuntimeError('编码产生非有限值')
276
+ if (np.sum(canonical.astype(np.float64) ** 2, axis=1) >= 1).any():
277
+ raise RuntimeError('编码超出单位球')
278
+ for index, record in enumerate(metadata):
279
+ vector_hash = hashlib.sha256(canonical[index].tobytes()).hexdigest()
280
+ keys = (record['id'], record['image_sha256'], vector_hash)
281
+ if any(key in collection for key, collection in zip(keys, seen)):
282
+ excluded.append({'id': record['id'], 'reason': '重复 ID、图像内容或规范向量'})
283
+ continue
284
+ for key, collection in zip(keys, seen):
285
+ collection.add(key)
286
+ record['vector_sha256'] = vector_hash
287
+ output_vectors[len(accepted)] = spatial[index]
288
+ accepted.append(record)
289
+ if len(accepted) == remaining:
290
+ break
291
+ if len(accepted) == remaining:
292
+ break
293
+ directory = ROOT / 'shards' / f'{shard:03d}.partial'
294
+ directory.mkdir(exist_ok=True)
295
+ np.save(directory / 'spatial.npy', output_vectors[:len(accepted)])
296
+ with (directory / 'samples.jsonl').open('w', encoding='utf-8') as output:
297
+ for record in accepted:
298
+ output.write(json.dumps(record, ensure_ascii=False) + '\n')
299
+ output.flush()
300
+ os.fsync(output.fileno())
301
+ atomic_json(directory / 'excluded.json', excluded)
302
+ statistics = {'shard': shard, 'accepted': len(accepted), 'excluded': len(excluded), 'available_images': len(records), 'encoding_seconds': time.perf_counter() - started, 'download': download, 'curvature': curvature, 'spatial_sha256': checksum(directory / 'spatial.npy'), 'samples_sha256': checksum(directory / 'samples.jsonl'), 'source_md5_sha256': checksum(md5_path)}
303
+ shutil.copy2(md5_path, directory / 'official.md5')
304
+ with (directory / 'spatial.npy').open('rb') as output:
305
+ os.fsync(output.fileno())
306
+ atomic_json(directory / 'complete.json', statistics)
307
+ directory.rename(ROOT / 'shards' / f'{shard:03d}')
308
+ source.unlink()
309
+ md5_path.unlink()
310
+ print('分片编码完成 ' + json.dumps(statistics, ensure_ascii=False), flush=True)
311
+ return len(accepted)
312
+
313
+
314
+ def collect_vectors(order, model):
315
+ seen = (set(), set(), set())
316
+ total = 0
317
+ pending = []
318
+ for shard in order:
319
+ directory = ROOT / 'shards' / f'{shard:03d}'
320
+ if not directory.exists():
321
+ pending.append(shard)
322
+ continue
323
+ statistics = json.loads((directory / 'complete.json').read_text())
324
+ if checksum(directory / 'spatial.npy') != statistics['spatial_sha256'] or checksum(directory / 'samples.jsonl') != statistics['samples_sha256']:
325
+ raise RuntimeError(f'已完成分片校验失败 {shard}')
326
+ for line in (directory / 'samples.jsonl').read_text().splitlines():
327
+ record = json.loads(line)
328
+ keys = (record['id'], record['image_sha256'], record['vector_sha256'])
329
+ if any(key in collection for key, collection in zip(keys, seen)):
330
+ raise RuntimeError('已完成分片存在重复样本')
331
+ for key, collection in zip(keys, seen):
332
+ collection.add(key)
333
+ total += 1
334
+ if total >= TOTAL_COUNT:
335
+ return
336
+ update_status('下载与编码', accepted=total, target=TOTAL_COUNT)
337
+ pool = concurrent.futures.ThreadPoolExecutor(max_workers=PREFETCH_SHARDS)
338
+ futures = {}
339
+ try:
340
+ for position, shard in enumerate(pending):
341
+ if total == TOTAL_COUNT:
342
+ break
343
+ for next_shard in pending[position:position + PREFETCH_SHARDS]:
344
+ if next_shard not in futures:
345
+ futures[next_shard] = pool.submit(download_archive, next_shard)
346
+ source, md5_path, download = futures.pop(shard).result()
347
+ total += encode_archive(model, shard, source, md5_path, download, TOTAL_COUNT - total, seen)
348
+ update_status('下载与编码', accepted=total, target=TOTAL_COUNT, last_shard=shard)
349
+ finally:
350
+ pool.shutdown(wait=True, cancel_futures=True)
351
+
352
+
353
+ def make_splits(order, curvature):
354
+ destination = ROOT / 'dataset'
355
+ destination.mkdir(exist_ok=True)
356
+ if (destination / 'splits_complete.json').exists():
357
+ return
358
+ update_status('划分向量', accepted=TOTAL_COUNT)
359
+ vectors = np.empty((TOTAL_COUNT, DIMENSIONS), dtype='<f4')
360
+ records = []
361
+ offset = 0
362
+ for shard in order:
363
+ directory = ROOT / 'shards' / f'{shard:03d}'
364
+ if not directory.exists():
365
+ continue
366
+ block = np.load(directory / 'spatial.npy')
367
+ vectors[offset:offset + len(block)] = block
368
+ records.extend(json.loads(line) for line in (directory / 'samples.jsonl').read_text().splitlines())
369
+ offset += len(block)
370
+ if offset != TOTAL_COUNT or len(records) != TOTAL_COUNT:
371
+ raise RuntimeError('总样本数量不符')
372
+ permutation = np.random.default_rng(SEED + 1).permutation(TOTAL_COUNT)
373
+ splits = [('queries', permutation[:QUERY_COUNT]), ('tuning_queries', permutation[QUERY_COUNT:QUERY_COUNT + TUNING_COUNT]), ('documents', permutation[QUERY_COUNT + TUNING_COUNT:])]
374
+ statistics = {}
375
+ for name, indices in splits:
376
+ spatial = np.memmap(destination / f'{name}_model_spatial.f32', dtype='<f4', mode='w+', shape=(len(indices), DIMENSIONS))
377
+ canonical = np.memmap(destination / f'{name}.f32', dtype='<f4', mode='w+', shape=(len(indices), DIMENSIONS))
378
+ radii = []
379
+ with gzip.open(destination / f'{name}_manifest.jsonl.gz', 'wt', encoding='utf-8') as output:
380
+ for start in range(0, len(indices), 4096):
381
+ rows = indices[start:start + 4096]
382
+ block = vectors[rows]
383
+ mapped = canonical_coordinates(block, curvature)
384
+ spatial[start:start + len(rows)] = block
385
+ canonical[start:start + len(rows)] = mapped
386
+ radii.append(np.linalg.norm(mapped.astype(np.float64), axis=1))
387
+ for local, source_row in enumerate(rows):
388
+ record = records[int(source_row)]
389
+ if hashlib.sha256(mapped[local].tobytes()).hexdigest() != record['vector_sha256']:
390
+ raise RuntimeError('规范坐标与分片指纹不一致')
391
+ output.write(json.dumps({'row': start + local, **record}, ensure_ascii=False) + '\n')
392
+ spatial.flush()
393
+ canonical.flush()
394
+ for path in [destination / f'{name}.f32', destination / f'{name}_model_spatial.f32']:
395
+ with path.open('rb') as output:
396
+ os.fsync(output.fileno())
397
+ radii = np.concatenate(radii)
398
+ statistics[name] = {'count': len(indices), 'radius_quantiles': np.quantile(radii, [0, .01, .1, .5, .9, .99, 1]).tolist(), 'geodesic_radius_quantiles': (2 * np.arctanh(np.quantile(radii, [0, .01, .1, .5, .9, .99, 1]))).tolist(), 'finite': bool(np.isfinite(canonical).all()), 'inside_ball': bool((radii < 1).all())}
399
+ if not statistics[name]['finite'] or not statistics[name]['inside_ball']:
400
+ raise RuntimeError('划分结果的流形约束失败')
401
+ atomic_json(destination / 'splits_complete.json', statistics)
402
+
403
+
404
+ def stable_topk(scores, count):
405
+ values, indices = torch.topk(scores, count + 1, dim=1, largest=False, sorted=True)
406
+ boundary_ties = torch.nonzero(values[:, count - 1] == values[:, count], as_tuple=False).flatten().tolist()
407
+ indices = indices[:, :count].clone()
408
+ for row in boundary_ties:
409
+ threshold = values[row, count - 1]
410
+ smaller = torch.nonzero(scores[row] < threshold, as_tuple=False).flatten()
411
+ equal = torch.nonzero(scores[row] == threshold, as_tuple=False).flatten()[:count - len(smaller)]
412
+ indices[row] = torch.cat([smaller, equal])
413
+ indices = torch.sort(indices, dim=1).values
414
+ selected = torch.gather(scores, 1, indices)
415
+ order = torch.argsort(selected, dim=1, stable=True)
416
+ return torch.gather(indices, 1, order), torch.gather(selected, 1, order)
417
+
418
+
419
+ @torch.inference_mode()
420
+ def compute_truth(root=ROOT):
421
+ destination = root / 'dataset'
422
+ if (destination / 'truth_complete.json').exists():
423
+ return
424
+ update_status('计算 FP64 真值', root=root)
425
+ base = np.memmap(destination / 'documents.f32', dtype='<f4', mode='r', shape=(BASE_COUNT, DIMENSIONS))
426
+ device_base = torch.tensor(np.asarray(base), dtype=torch.float64, device='cuda')
427
+ norm_base = (device_base * device_base).sum(1)
428
+ results = {}
429
+ for name, count in [('queries', QUERY_COUNT), ('tuning_queries', TUNING_COUNT)]:
430
+ started = time.perf_counter()
431
+ query = np.memmap(destination / f'{name}.f32', dtype='<f4', mode='r', shape=(count, DIMENSIONS))
432
+ ids = np.memmap(destination / f'{name}_top100.u64', dtype='<u8', mode='w+', shape=(count, 100))
433
+ distances = np.memmap(destination / f'{name}_top100_distances.f64', dtype='<f8', mode='w+', shape=(count, 100))
434
+ for start in range(0, count, 64):
435
+ current = torch.tensor(np.asarray(query[start:start + 64]), dtype=torch.float64, device='cuda')
436
+ norm_query = (current * current).sum(1)
437
+ score = current @ device_base.T
438
+ score.mul_(-2).add_(norm_base[None, :]).add_(norm_query[:, None]).clamp_min_(0)
439
+ score.div_((1 - norm_base)[None, :]).div_((1 - norm_query)[:, None])
440
+ indices, values = stable_topk(score, 100)
441
+ ids[start:start + len(current)] = indices.cpu().numpy().astype('<u8')
442
+ distances[start:start + len(current)] = torch.acosh(1 + 2 * values).cpu().numpy()
443
+ if start % 1024 == 0:
444
+ update_status('计算 FP64 真值', root=root, split=name, completed=start + len(current), total=count)
445
+ del score
446
+ ids.flush()
447
+ distances.flush()
448
+ truth_name = 'truth.u64' if name == 'queries' else 'tuning_truth.u64'
449
+ np.asarray(ids[:, :10]).tofile(destination / truth_name)
450
+ results[name] = {'count': count, 'topk': 100, 'seconds': time.perf_counter() - started, 'method': 'FP64 全扫描,按双曲代理距离与行号排序'}
451
+ atomic_json(destination / 'truth_complete.json', results)
452
+
453
+
454
+ def verify_truth(root=ROOT):
455
+ destination = root / 'dataset'
456
+ if (destination / 'verification.json').exists():
457
+ return
458
+ update_status('独立 CPU 直接坐标差核验', root=root)
459
+ base = np.memmap(destination / 'documents.f32', dtype='<f4', mode='r', shape=(BASE_COUNT, DIMENSIONS))
460
+ query = np.memmap(destination / 'queries.f32', dtype='<f4', mode='r', shape=(QUERY_COUNT, DIMENSIONS))
461
+ truth = np.memmap(destination / 'queries_top100.u64', dtype='<u8', mode='r', shape=(QUERY_COUNT, 100))
462
+ sample_rows = np.random.default_rng(SEED + 2).choice(QUERY_COUNT, 16, replace=False)
463
+ maximum_error = 0.0
464
+ stored_distances = np.memmap(destination / 'queries_top100_distances.f64', dtype='<f8', mode='r', shape=(QUERY_COUNT, 100))
465
+ for row in sample_rows:
466
+ current = np.asarray(query[row], dtype=np.float64)
467
+ scores = np.empty(BASE_COUNT, dtype=np.float64)
468
+ qnorm = current @ current
469
+ for start in range(0, BASE_COUNT, 8192):
470
+ block = np.asarray(base[start:start + 8192], dtype=np.float64)
471
+ norm = np.sum(block * block, axis=1)
472
+ differences = block - current
473
+ scores[start:start + len(block)] = np.sum(differences * differences, axis=1) / (1 - norm) / (1 - qnorm)
474
+ expected = np.argsort(scores, kind='stable')[:100]
475
+ if not np.array_equal(expected, truth[row]):
476
+ raise RuntimeError(f'独立近邻核验失败,查询行 {row}')
477
+ distances = np.arccosh(1 + 2 * scores[expected])
478
+ maximum_error = max(maximum_error, float(np.max(np.abs(distances - stored_distances[row]))))
479
+ split_ids = []
480
+ for name in ['documents', 'queries', 'tuning_queries']:
481
+ with gzip.open(destination / f'{name}_manifest.jsonl.gz', 'rt', encoding='utf-8') as source:
482
+ split_ids.append({json.loads(line)['id'] for line in source})
483
+ if any(split_ids[a] & split_ids[b] for a, b in [(0, 1), (0, 2), (1, 2)]):
484
+ raise RuntimeError('划分之间存在重复 ID')
485
+ atomic_json(destination / 'verification.json', {'complete': True, 'cpu_direct_difference_queries': sample_rows.tolist(), 'cpu_top100_equal': True, 'maximum_distance_error': maximum_error, 'split_counts': [len(values) for values in split_ids], 'disjoint_ids': True})
486
+
487
+
488
+ def finalize(curvature):
489
+ destination = ROOT / 'dataset'
490
+ files = {}
491
+ for path in sorted(destination.iterdir()):
492
+ if path.is_file() and path.name not in ['mapping.json', 'README.md']:
493
+ files[path.name] = {'bytes': path.stat().st_size, 'sha256': checksum(path)}
494
+ metadata = {
495
+ **CONFIG,
496
+ 'original_curvature_parameter': curvature,
497
+ 'documents': BASE_COUNT,
498
+ 'queries': QUERY_COUNT,
499
+ 'tuning_queries': TUNING_COUNT,
500
+ 'created_utc_epoch': time.time(),
501
+ 'original_distance_from_canonical': '原始曲率距离等于规范曲率距离除以原始曲率参数的平方根',
502
+ 'files': files,
503
+ 'versions': {name: importlib.metadata.version(name) for name in ['torch', 'torchvision', 'timm', 'Pillow', 'numpy']},
504
+ 'gpu': torch.cuda.get_device_name(0),
505
+ 'build_script_sha256': checksum(Path(__file__)),
506
+ 'download_workers_per_shard': DOWNLOAD_WORKERS,
507
+ 'prefetch_shards': PREFETCH_SHARDS,
508
+ 'source_image_license': 'https://github.com/cvdfoundation/google-landmark#train-image-licenses',
509
+ }
510
+ atomic_json(destination / 'mapping.json', metadata)
511
+ readme = '''# MERU GLDv2 百万级双曲 ANN 数据集
512
+
513
+ 由固定 MERU ViT-small 权重编码 GLDv2 train 图像,使用 FP32 并关闭 TF32。固定种子打乱分片和样本,全局去重图像 ID、图像字��和规范向量字节。
514
+
515
+ ## 文件
516
+
517
+ - documents.f32 包含 1,000,000 行、512 列的库向量。
518
+ - queries.f32 包含 10,000 行、512 列的测试查询。
519
+ - tuning_queries.f32 包含 2,000 行、512 列的调参查询。
520
+ - 上述文件使用无头部、小端 FP32、行优先布局,坐标位于曲率 −1 的单位 Poincaré 球。
521
+ - 名称含 model_spatial 的文件保留 MERU 原始 Lorentz 空间分量。原始曲率参数保存在 mapping.json。
522
+ - truth.u64 和 tuning_truth.u64 按查询逐行保存前 10 个库行号,使用小端 uint64。
523
+ - 名称含 top100 的文件保存前 100 个库行号及对应的双曲测地距离,分别使用 uint64 和 FP64。
524
+ - 名称含 manifest 的压缩 JSONL 保存行号、原始图像 ID、源分片、TAR 成员名、MD5、图像 SHA256 和规范向量 SHA256。
525
+ - mapping.json 保存格式、来源、模型版本、软件版本和各文件 SHA256。
526
+ - verification.json 保存独立 CPU 直接坐标差全扫描核验结果。
527
+
528
+ ## 重现
529
+
530
+ 源码保存在上一级 build_dataset.py。使用试跑环境的 Python 执行该脚本即可断点恢复。模型和图像下载地址、版本与随机种子均固定在脚本中。
531
+
532
+ ## 来源
533
+
534
+ 原始图像来自 https://github.com/cvdfoundation/google-landmark ,单图授权和署名可按图像 ID 在官方 train_attribution.csv 查询。
535
+
536
+ 模型来自 https://github.com/facebookresearch/meru ,权重指纹与源码提交保存在 mapping.json。本数据集保存图像派生向量和来源清单。
537
+ '''
538
+ (destination / 'README.md').write_text(readme, encoding='utf-8')
539
+ atomic_json(ROOT / 'complete.json', {'complete': True, 'dataset': str(destination), 'mapping_sha256': checksum(destination / 'mapping.json'), 'files': len(files), 'timestamp': time.time()})
540
+ update_status('完成', accepted=TOTAL_COUNT, dataset=str(destination))
541
+
542
+
543
+ def main():
544
+ ROOT.mkdir(exist_ok=True)
545
+ for name in ['cache', 'shards']:
546
+ (ROOT / name).mkdir(exist_ok=True)
547
+ if (ROOT / 'complete.json').exists():
548
+ print('数据集已完成', flush=True)
549
+ return
550
+ config_path = ROOT / 'config.json'
551
+ if config_path.exists() and json.loads(config_path.read_text()) != CONFIG:
552
+ raise RuntimeError('已有任务配置不同')
553
+ atomic_json(config_path, CONFIG)
554
+ torch.set_num_threads(4)
555
+ torch.backends.cuda.matmul.allow_tf32 = False
556
+ torch.backends.cudnn.allow_tf32 = False
557
+ random.seed(SEED)
558
+ np.random.seed(SEED)
559
+ torch.manual_seed(SEED)
560
+ order = np.random.default_rng(SEED).permutation(500).tolist()
561
+ atomic_json(ROOT / 'shard_order.json', order)
562
+ model = load_model()
563
+ curvature = model.curv.exp().item()
564
+ collect_vectors(order, model)
565
+ del model
566
+ torch.cuda.empty_cache()
567
+ make_splits(order, curvature)
568
+ compute_truth()
569
+ verify_truth()
570
+ finalize(curvature)
571
+
572
+
573
+ if __name__ == '__main__':
574
+ ROOT.mkdir(exist_ok=True)
575
+ lock = (ROOT / '.build.lock').open('a')
576
+ try:
577
+ fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
578
+ except BlockingIOError:
579
+ print('已有数据制作进程持有任务锁', flush=True)
580
+ sys.exit(1)
581
+ try:
582
+ main()
583
+ except Exception as error:
584
+ if ROOT.exists():
585
+ update_status('失败', error=f'{type(error).__name__} {error}')
586
+ raise
splits_complete.json ADDED
@@ -0,0 +1,1051 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "documents": {
3
+ "count": 1000000,
4
+ "source_split": "train",
5
+ "radius_quantiles": [
6
+ 0.11673327310289958,
7
+ 0.12216881046034093,
8
+ 0.12438219446039223,
9
+ 0.1270496393963092,
10
+ 0.12945898258724461,
11
+ 0.13114611115268685,
12
+ 0.13501184398047403
13
+ ],
14
+ "finite": true,
15
+ "inside_ball": true,
16
+ "class_counts": {
17
+ "n02051845": 1026,
18
+ "n01775062": 995,
19
+ "n02098413": 1012,
20
+ "n03837869": 1044,
21
+ "n03485794": 1019,
22
+ "n02963159": 1024,
23
+ "n02109047": 1023,
24
+ "n03220513": 995,
25
+ "n02071294": 1008,
26
+ "n07760859": 1028,
27
+ "n02229544": 1032,
28
+ "n02841315": 1008,
29
+ "n02110806": 1013,
30
+ "n01601694": 1003,
31
+ "n04326547": 1024,
32
+ "n01749939": 1013,
33
+ "n02102973": 762,
34
+ "n01985128": 1006,
35
+ "n13037406": 1006,
36
+ "n02641379": 1008,
37
+ "n03769881": 1017,
38
+ "n01616318": 1025,
39
+ "n03344393": 1027,
40
+ "n03424325": 1003,
41
+ "n04146614": 1012,
42
+ "n02112018": 1029,
43
+ "n03623198": 1030,
44
+ "n07718747": 1019,
45
+ "n02027492": 1028,
46
+ "n03782006": 992,
47
+ "n02105056": 1012,
48
+ "n04153751": 1037,
49
+ "n02091831": 1018,
50
+ "n07584110": 966,
51
+ "n02415577": 969,
52
+ "n02111500": 999,
53
+ "n02138441": 1020,
54
+ "n04149813": 1011,
55
+ "n01443537": 1002,
56
+ "n03676483": 1019,
57
+ "n02494079": 1022,
58
+ "n02099712": 1014,
59
+ "n03445777": 1023,
60
+ "n04392985": 928,
61
+ "n04204347": 1018,
62
+ "n03649909": 1012,
63
+ "n03788365": 1012,
64
+ "n07831146": 1030,
65
+ "n02114367": 1020,
66
+ "n07693725": 1025,
67
+ "n02105412": 1019,
68
+ "n07715103": 1026,
69
+ "n02280649": 1026,
70
+ "n03825788": 1029,
71
+ "n01774384": 1011,
72
+ "n02095570": 1041,
73
+ "n04074963": 1006,
74
+ "n04604644": 1011,
75
+ "n04311004": 902,
76
+ "n02096294": 976,
77
+ "n01641577": 998,
78
+ "n04461696": 1033,
79
+ "n01770081": 1039,
80
+ "n02112706": 836,
81
+ "n03134739": 1017,
82
+ "n03476991": 763,
83
+ "n03404251": 1007,
84
+ "n02769748": 1035,
85
+ "n01773797": 959,
86
+ "n03770439": 1006,
87
+ "n04435653": 1003,
88
+ "n03450230": 1002,
89
+ "n03924679": 1018,
90
+ "n02749479": 1023,
91
+ "n01945685": 1035,
92
+ "n03388043": 1019,
93
+ "n03196217": 1017,
94
+ "n02788148": 1018,
95
+ "n03929660": 931,
96
+ "n03584829": 1028,
97
+ "n03902125": 1020,
98
+ "n02268443": 1028,
99
+ "n03706229": 926,
100
+ "n04596742": 992,
101
+ "n01860187": 1032,
102
+ "n03388183": 1016,
103
+ "n02127052": 1027,
104
+ "n02916936": 913,
105
+ "n03417042": 1028,
106
+ "n07720875": 1025,
107
+ "n03124043": 1036,
108
+ "n03832673": 988,
109
+ "n04008634": 809,
110
+ "n02236044": 984,
111
+ "n04371774": 1021,
112
+ "n01818515": 999,
113
+ "n04509417": 1009,
114
+ "n02883205": 1005,
115
+ "n02091032": 1017,
116
+ "n01871265": 1032,
117
+ "n02097130": 1003,
118
+ "n02012849": 1025,
119
+ "n02009229": 1012,
120
+ "n02514041": 1020,
121
+ "n04370456": 707,
122
+ "n03598930": 1042,
123
+ "n04026417": 987,
124
+ "n04252225": 999,
125
+ "n02823750": 1003,
126
+ "n03594734": 1013,
127
+ "n03992509": 1018,
128
+ "n04019541": 1052,
129
+ "n04201297": 1001,
130
+ "n04259630": 1020,
131
+ "n04254777": 1032,
132
+ "n02093647": 970,
133
+ "n03637318": 1001,
134
+ "n04265275": 780,
135
+ "n04070727": 1031,
136
+ "n02484975": 1020,
137
+ "n07583066": 1019,
138
+ "n04486054": 1021,
139
+ "n03742115": 1012,
140
+ "n02510455": 1043,
141
+ "n03347037": 1048,
142
+ "n01440764": 1027,
143
+ "n03891251": 1020,
144
+ "n03666591": 1026,
145
+ "n03259280": 1020,
146
+ "n03661043": 1023,
147
+ "n02892767": 1013,
148
+ "n01614925": 1015,
149
+ "n03777568": 1026,
150
+ "n02480495": 1019,
151
+ "n02279972": 1014,
152
+ "n02708093": 1034,
153
+ "n03197337": 709,
154
+ "n02701002": 1032,
155
+ "n04523525": 1017,
156
+ "n02002724": 1001,
157
+ "n02814860": 1015,
158
+ "n02442845": 951,
159
+ "n04476259": 1040,
160
+ "n02951358": 1013,
161
+ "n03961711": 852,
162
+ "n02177972": 1013,
163
+ "n02101556": 1031,
164
+ "n03776460": 1003,
165
+ "n02791270": 1009,
166
+ "n02823428": 1019,
167
+ "n01768244": 1051,
168
+ "n03729826": 998,
169
+ "n02106166": 946,
170
+ "n02259212": 1010,
171
+ "n03691459": 1022,
172
+ "n01531178": 1025,
173
+ "n04536866": 1021,
174
+ "n02865351": 1034,
175
+ "n02088466": 1025,
176
+ "n03791053": 1033,
177
+ "n02281406": 1008,
178
+ "n03376595": 1005,
179
+ "n03785016": 1012,
180
+ "n03017168": 1011,
181
+ "n02699494": 1010,
182
+ "n01697457": 1017,
183
+ "n02879718": 1018,
184
+ "n02007558": 1030,
185
+ "n02109525": 1016,
186
+ "n03773504": 1026,
187
+ "n03271574": 1011,
188
+ "n02025239": 1018,
189
+ "n01917289": 1003,
190
+ "n02115913": 1012,
191
+ "n03956157": 979,
192
+ "n02395406": 1010,
193
+ "n07730033": 875,
194
+ "n02447366": 998,
195
+ "n02090379": 988,
196
+ "n03786901": 1047,
197
+ "n03710193": 991,
198
+ "n02423022": 1009,
199
+ "n02981792": 1033,
200
+ "n02123394": 1007,
201
+ "n02843684": 1037,
202
+ "n02085936": 1046,
203
+ "n03908618": 1032,
204
+ "n04548362": 1041,
205
+ "n03891332": 998,
206
+ "n02834397": 1031,
207
+ "n02536864": 998,
208
+ "n02097474": 990,
209
+ "n03146219": 936,
210
+ "n04277352": 1000,
211
+ "n02095889": 716,
212
+ "n07590611": 888,
213
+ "n02906734": 1035,
214
+ "n04162706": 1024,
215
+ "n02090622": 1052,
216
+ "n01692333": 1019,
217
+ "n02107574": 1005,
218
+ "n03733131": 1044,
219
+ "n04366367": 1009,
220
+ "n04039381": 1033,
221
+ "n02667093": 1026,
222
+ "n03903868": 878,
223
+ "n02123597": 985,
224
+ "n01828970": 1026,
225
+ "n01687978": 1014,
226
+ "n01872401": 1024,
227
+ "n03868242": 1016,
228
+ "n07615774": 1030,
229
+ "n01530575": 1029,
230
+ "n04507155": 1006,
231
+ "n02085782": 610,
232
+ "n03866082": 766,
233
+ "n02655020": 1004,
234
+ "n02074367": 1019,
235
+ "n02100877": 1020,
236
+ "n03478589": 1013,
237
+ "n01677366": 1016,
238
+ "n01873310": 985,
239
+ "n02917067": 1003,
240
+ "n02116738": 992,
241
+ "n04086273": 1000,
242
+ "n03804744": 1010,
243
+ "n04442312": 1031,
244
+ "n03884397": 1064,
245
+ "n04330267": 1016,
246
+ "n04141975": 1013,
247
+ "n03379051": 1025,
248
+ "n01735189": 1004,
249
+ "n02787622": 1029,
250
+ "n02607072": 997,
251
+ "n04154565": 1010,
252
+ "n04243546": 1002,
253
+ "n03958227": 831,
254
+ "n04296562": 1015,
255
+ "n04254680": 1017,
256
+ "n02965783": 1007,
257
+ "n04254120": 998,
258
+ "n01632458": 984,
259
+ "n03710637": 1023,
260
+ "n03887697": 1022,
261
+ "n03388549": 1037,
262
+ "n02454379": 1018,
263
+ "n02091134": 1014,
264
+ "n03394916": 1007,
265
+ "n03814639": 931,
266
+ "n03680355": 907,
267
+ "n02992211": 1040,
268
+ "n02102480": 1006,
269
+ "n02486410": 1027,
270
+ "n04273569": 1028,
271
+ "n04423845": 1040,
272
+ "n03216828": 968,
273
+ "n02017213": 984,
274
+ "n03743016": 1021,
275
+ "n04417672": 1008,
276
+ "n03781244": 891,
277
+ "n07697537": 1052,
278
+ "n04517823": 1029,
279
+ "n06794110": 1023,
280
+ "n02892201": 1014,
281
+ "n02948072": 1017,
282
+ "n04251144": 998,
283
+ "n04335435": 1034,
284
+ "n01784675": 1031,
285
+ "n03868863": 994,
286
+ "n03877472": 1057,
287
+ "n03042490": 1021,
288
+ "n03297495": 879,
289
+ "n04443257": 982,
290
+ "n03983396": 1006,
291
+ "n03717622": 1003,
292
+ "n03814906": 1025,
293
+ "n01756291": 779,
294
+ "n02825657": 1028,
295
+ "n01669191": 1020,
296
+ "n13052670": 987,
297
+ "n04040759": 990,
298
+ "n01693334": 951,
299
+ "n03062245": 913,
300
+ "n03950228": 1008,
301
+ "n07930864": 1028,
302
+ "n04099969": 1017,
303
+ "n04317175": 1010,
304
+ "n04371430": 1022,
305
+ "n01682714": 1018,
306
+ "n01494475": 1029,
307
+ "n01698640": 1021,
308
+ "n02102318": 1021,
309
+ "n10148035": 1027,
310
+ "n02802426": 1017,
311
+ "n02134418": 988,
312
+ "n01744401": 840,
313
+ "n03494278": 1012,
314
+ "n03444034": 1004,
315
+ "n03657121": 1043,
316
+ "n02086646": 1014,
317
+ "n01984695": 1006,
318
+ "n03709823": 1020,
319
+ "n02909870": 1011,
320
+ "n02398521": 1020,
321
+ "n02110627": 757,
322
+ "n02417914": 1016,
323
+ "n03930313": 1024,
324
+ "n02690373": 1004,
325
+ "n02100735": 1004,
326
+ "n04209239": 1029,
327
+ "n03761084": 1022,
328
+ "n03527444": 1025,
329
+ "n04200800": 992,
330
+ "n02999410": 1025,
331
+ "n04462240": 995,
332
+ "n02483708": 999,
333
+ "n02088094": 1026,
334
+ "n02437312": 1021,
335
+ "n01990800": 1026,
336
+ "n09835506": 1024,
337
+ "n02979186": 1008,
338
+ "n03016953": 982,
339
+ "n02860847": 1028,
340
+ "n04597913": 990,
341
+ "n02364673": 1036,
342
+ "n02493509": 991,
343
+ "n02509815": 999,
344
+ "n04229816": 1019,
345
+ "n02443114": 965,
346
+ "n02137549": 1028,
347
+ "n02264363": 1021,
348
+ "n03929855": 1007,
349
+ "n04136333": 1027,
350
+ "n01924916": 1009,
351
+ "n03109150": 1004,
352
+ "n03063599": 1030,
353
+ "n02093256": 1012,
354
+ "n02980441": 1000,
355
+ "n02814533": 1035,
356
+ "n04553703": 1020,
357
+ "n01694178": 1020,
358
+ "n03495258": 992,
359
+ "n03425413": 1040,
360
+ "n03483316": 1024,
361
+ "n03796401": 918,
362
+ "n02640242": 982,
363
+ "n02422699": 1004,
364
+ "n02097209": 998,
365
+ "n02011460": 987,
366
+ "n02088632": 883,
367
+ "n02096177": 1035,
368
+ "n02790996": 1020,
369
+ "n01986214": 991,
370
+ "n01950731": 1020,
371
+ "n02804610": 1031,
372
+ "n02125311": 1034,
373
+ "n03041632": 855,
374
+ "n02120505": 999,
375
+ "n04418357": 1003,
376
+ "n03218198": 1024,
377
+ "n02776631": 1020,
378
+ "n04141076": 994,
379
+ "n03126707": 1015,
380
+ "n03272010": 1008,
381
+ "n02412080": 1012,
382
+ "n02105505": 1017,
383
+ "n06596364": 1042,
384
+ "n02100236": 1012,
385
+ "n07717556": 1007,
386
+ "n02268853": 1016,
387
+ "n01695060": 994,
388
+ "n04447861": 1031,
389
+ "n04120489": 991,
390
+ "n02105251": 1009,
391
+ "n02107142": 1025,
392
+ "n02317335": 997,
393
+ "n04479046": 817,
394
+ "n03794056": 1006,
395
+ "n02110958": 1008,
396
+ "n10565667": 1026,
397
+ "n03633091": 1007,
398
+ "n02119022": 1025,
399
+ "n09229709": 1000,
400
+ "n07684084": 1011,
401
+ "n03207743": 1033,
402
+ "n04398044": 1013,
403
+ "n02219486": 1009,
404
+ "n02480855": 1024,
405
+ "n03393912": 1031,
406
+ "n04350905": 1021,
407
+ "n01843065": 1004,
408
+ "n02096585": 1014,
409
+ "n03877845": 1020,
410
+ "n02113624": 1025,
411
+ "n04525305": 996,
412
+ "n03100240": 1018,
413
+ "n02526121": 908,
414
+ "n03764736": 874,
415
+ "n04501370": 1021,
416
+ "n01737021": 1008,
417
+ "n04270147": 1030,
418
+ "n13133613": 1006,
419
+ "n03538406": 1043,
420
+ "n02013706": 1036,
421
+ "n01978287": 1000,
422
+ "n03201208": 1023,
423
+ "n03935335": 1007,
424
+ "n04525038": 829,
425
+ "n03899768": 899,
426
+ "n02097047": 1039,
427
+ "n02488702": 1029,
428
+ "n02086079": 1016,
429
+ "n02445715": 1039,
430
+ "n02132136": 1023,
431
+ "n03916031": 1021,
432
+ "n02672831": 1012,
433
+ "n03467068": 1004,
434
+ "n02077923": 1024,
435
+ "n02840245": 1008,
436
+ "n04311174": 1024,
437
+ "n01582220": 1022,
438
+ "n04532670": 1005,
439
+ "n02793495": 1029,
440
+ "n02910353": 1025,
441
+ "n01748264": 1000,
442
+ "n02018795": 1020,
443
+ "n02978881": 954,
444
+ "n09421951": 1022,
445
+ "n02835271": 1021,
446
+ "n04209133": 1011,
447
+ "n01608432": 1015,
448
+ "n01742172": 1022,
449
+ "n03841143": 1002,
450
+ "n07873807": 990,
451
+ "n02172182": 1029,
452
+ "n04584207": 1031,
453
+ "n02104029": 1014,
454
+ "n04325704": 1010,
455
+ "n04599235": 1011,
456
+ "n02093754": 1029,
457
+ "n02325366": 1017,
458
+ "n04116512": 999,
459
+ "n01580077": 1019,
460
+ "n04458633": 1013,
461
+ "n01980166": 1014,
462
+ "n03720891": 1017,
463
+ "n02277742": 1019,
464
+ "n07932039": 928,
465
+ "n02006656": 1009,
466
+ "n04004767": 987,
467
+ "n12620546": 1013,
468
+ "n02859443": 985,
469
+ "n03532672": 1033,
470
+ "n04133789": 1027,
471
+ "n03871628": 1035,
472
+ "n02441942": 1005,
473
+ "n02104365": 1037,
474
+ "n02111129": 1036,
475
+ "n04111531": 1038,
476
+ "n02877765": 1025,
477
+ "n02481823": 988,
478
+ "n02786058": 1006,
479
+ "n04579432": 1026,
480
+ "n03942813": 1011,
481
+ "n02500267": 1015,
482
+ "n04465501": 1024,
483
+ "n02114712": 1015,
484
+ "n02422106": 1008,
485
+ "n03874599": 1002,
486
+ "n02107683": 1022,
487
+ "n03874293": 1027,
488
+ "n02114548": 1010,
489
+ "n13040303": 1039,
490
+ "n04515003": 1026,
491
+ "n03482405": 984,
492
+ "n01592084": 1022,
493
+ "n07753275": 1028,
494
+ "n09246464": 992,
495
+ "n02808440": 1018,
496
+ "n02134084": 1013,
497
+ "n03124170": 1019,
498
+ "n04347754": 1019,
499
+ "n02129604": 1020,
500
+ "n01558993": 1009,
501
+ "n12998815": 1022,
502
+ "n04067472": 998,
503
+ "n03272562": 1037,
504
+ "n02231487": 1010,
505
+ "n03617480": 1040,
506
+ "n02101006": 1011,
507
+ "n03590841": 1018,
508
+ "n02111277": 1034,
509
+ "n03180011": 1024,
510
+ "n02112137": 1009,
511
+ "n04482393": 1036,
512
+ "n09428293": 1001,
513
+ "n02497673": 1019,
514
+ "n02342885": 991,
515
+ "n02396427": 905,
516
+ "n03803284": 882,
517
+ "n12985857": 1012,
518
+ "n09472597": 987,
519
+ "n01518878": 1033,
520
+ "n02113186": 990,
521
+ "n03787032": 945,
522
+ "n03544143": 1014,
523
+ "n02971356": 1020,
524
+ "n01776313": 1012,
525
+ "n03788195": 1014,
526
+ "n03888605": 998,
527
+ "n02086910": 1037,
528
+ "n02492035": 1021,
529
+ "n02110341": 1021,
530
+ "n02133161": 1010,
531
+ "n04127249": 1011,
532
+ "n03000134": 1002,
533
+ "n02165456": 1011,
534
+ "n04554684": 1020,
535
+ "n02091635": 586,
536
+ "n01667114": 1036,
537
+ "n02391049": 1017,
538
+ "n02168699": 1012,
539
+ "n07742313": 1017,
540
+ "n03291819": 1018,
541
+ "n04208210": 1006,
542
+ "n02115641": 1029,
543
+ "n02226429": 989,
544
+ "n04355933": 1018,
545
+ "n04081281": 1005,
546
+ "n03908714": 1028,
547
+ "n02437616": 1026,
548
+ "n01644900": 1032,
549
+ "n02113799": 1026,
550
+ "n01532829": 1022,
551
+ "n02233338": 1027,
552
+ "n03125729": 1037,
553
+ "n03461385": 1023,
554
+ "n03223299": 1021,
555
+ "n01943899": 1017,
556
+ "n03179701": 1017,
557
+ "n02504458": 988,
558
+ "n03770679": 1020,
559
+ "n02165105": 1010,
560
+ "n02098105": 988,
561
+ "n04118538": 1020,
562
+ "n04367480": 1010,
563
+ "n02028035": 1020,
564
+ "n03384352": 1035,
565
+ "n01855672": 1026,
566
+ "n01796340": 1014,
567
+ "n04263257": 1021,
568
+ "n01514859": 988,
569
+ "n02403003": 1035,
570
+ "n03443371": 1016,
571
+ "n02128385": 1049,
572
+ "n04456115": 1007,
573
+ "n02281787": 1009,
574
+ "n03843555": 896,
575
+ "n03452741": 1028,
576
+ "n01755581": 1006,
577
+ "n02108915": 987,
578
+ "n03697007": 1025,
579
+ "n02093859": 1001,
580
+ "n04548280": 1012,
581
+ "n04179913": 1032,
582
+ "n02100583": 1017,
583
+ "n02606052": 762,
584
+ "n02687172": 1006,
585
+ "n02099429": 964,
586
+ "n03250847": 1021,
587
+ "n03980874": 1030,
588
+ "n04275548": 1024,
589
+ "n04192698": 1001,
590
+ "n02056570": 1016,
591
+ "n02361337": 1016,
592
+ "n03496892": 1018,
593
+ "n04376876": 1006,
594
+ "n02492660": 1020,
595
+ "n03337140": 1013,
596
+ "n02130308": 1023,
597
+ "n12057211": 1018,
598
+ "n04285008": 1007,
599
+ "n03630383": 1048,
600
+ "n02817516": 940,
601
+ "n04557648": 999,
602
+ "n02105641": 1026,
603
+ "n02951585": 993,
604
+ "n02950826": 1040,
605
+ "n02504013": 1012,
606
+ "n04372370": 1022,
607
+ "n01774750": 1007,
608
+ "n04467665": 1007,
609
+ "n02493793": 1018,
610
+ "n09332890": 1005,
611
+ "n04252077": 1014,
612
+ "n04356056": 1017,
613
+ "n02088238": 1004,
614
+ "n04612504": 953,
615
+ "n03733805": 1006,
616
+ "n03920288": 740,
617
+ "n02457408": 1037,
618
+ "n02443484": 998,
619
+ "n01883070": 985,
620
+ "n03895866": 1019,
621
+ "n03127925": 999,
622
+ "n07711569": 1006,
623
+ "n03775071": 1026,
624
+ "n07697313": 1001,
625
+ "n04589890": 1000,
626
+ "n04409515": 1014,
627
+ "n02018207": 1005,
628
+ "n07875152": 1037,
629
+ "n01833805": 1013,
630
+ "n04228054": 1021,
631
+ "n03982430": 1022,
632
+ "n02444819": 1010,
633
+ "n02488291": 1029,
634
+ "n01877812": 1031,
635
+ "n01944390": 1007,
636
+ "n03447721": 921,
637
+ "n02085620": 1034,
638
+ "n03131574": 999,
639
+ "n01644373": 1025,
640
+ "n02321529": 1015,
641
+ "n04522168": 1000,
642
+ "n04542943": 896,
643
+ "n04235860": 1017,
644
+ "n01847000": 1001,
645
+ "n01806143": 1021,
646
+ "n02128757": 1018,
647
+ "n02808304": 1036,
648
+ "n03255030": 1010,
649
+ "n07614500": 1051,
650
+ "n02389026": 994,
651
+ "n07871810": 993,
652
+ "n03888257": 1017,
653
+ "n01807496": 808,
654
+ "n02326432": 994,
655
+ "n02837789": 1029,
656
+ "n04023962": 983,
657
+ "n03792972": 1013,
658
+ "n02782093": 1023,
659
+ "n01560419": 1022,
660
+ "n02113712": 1018,
661
+ "n01978455": 988,
662
+ "n02119789": 989,
663
+ "n12768682": 1016,
664
+ "n03930630": 1017,
665
+ "n01773549": 1006,
666
+ "n07749582": 1020,
667
+ "n04044716": 1009,
668
+ "n03777754": 892,
669
+ "n04483307": 1020,
670
+ "n03026506": 1034,
671
+ "n02124075": 1008,
672
+ "n01491361": 1036,
673
+ "n03208938": 1014,
674
+ "n02098286": 1017,
675
+ "n03976657": 1019,
676
+ "n02102040": 996,
677
+ "n04552348": 1011,
678
+ "n04118776": 1017,
679
+ "n01728572": 1042,
680
+ "n01689811": 992,
681
+ "n03692522": 1011,
682
+ "n01843383": 1031,
683
+ "n02169497": 1007,
684
+ "n02966193": 1003,
685
+ "n04286575": 1008,
686
+ "n02346627": 1017,
687
+ "n03400231": 975,
688
+ "n09288635": 1022,
689
+ "n02783161": 977,
690
+ "n02002556": 1000,
691
+ "n03933933": 1034,
692
+ "n02174001": 1036,
693
+ "n04485082": 893,
694
+ "n04344873": 992,
695
+ "n02106382": 1029,
696
+ "n15075141": 1015,
697
+ "n03014705": 1017,
698
+ "n03290653": 1021,
699
+ "n01622779": 1040,
700
+ "n01739381": 971,
701
+ "n02895154": 1022,
702
+ "n03529860": 1028,
703
+ "n01798484": 1003,
704
+ "n02256656": 1014,
705
+ "n01664065": 1010,
706
+ "n02099849": 1007,
707
+ "n07747607": 1015,
708
+ "n02129165": 1020,
709
+ "n01855032": 902,
710
+ "n04037443": 1045,
711
+ "n03160309": 1017,
712
+ "n04487081": 1047,
713
+ "n03089624": 1039,
714
+ "n01829413": 1048,
715
+ "n03018349": 1037,
716
+ "n02410509": 1007,
717
+ "n01498041": 1000,
718
+ "n01534433": 1023,
719
+ "n11879895": 1052,
720
+ "n07836838": 1029,
721
+ "n02797295": 1022,
722
+ "n02666196": 994,
723
+ "n03075370": 955,
724
+ "n02088364": 1013,
725
+ "n02276258": 1018,
726
+ "n03045698": 813,
727
+ "n03457902": 1022,
728
+ "n02058221": 1041,
729
+ "n02087394": 1035,
730
+ "n03187595": 997,
731
+ "n02988304": 1033,
732
+ "n04550184": 1020,
733
+ "n02483362": 1015,
734
+ "n03445924": 1033,
735
+ "n07579787": 1016,
736
+ "n03345487": 991,
737
+ "n04147183": 1039,
738
+ "n03095699": 1015,
739
+ "n03063689": 1008,
740
+ "n02096051": 1008,
741
+ "n02092002": 1012,
742
+ "n01734418": 993,
743
+ "n02093428": 996,
744
+ "n03710721": 830,
745
+ "n04310018": 1018,
746
+ "n02094433": 1017,
747
+ "n04562935": 1008,
748
+ "n03724870": 1033,
749
+ "n03498962": 682,
750
+ "n03032252": 1019,
751
+ "n03954731": 1033,
752
+ "n02869837": 1030,
753
+ "n02106550": 996,
754
+ "n01824575": 1026,
755
+ "n03207941": 1017,
756
+ "n04560804": 1038,
757
+ "n01685808": 1025,
758
+ "n02966687": 1026,
759
+ "n07753592": 1011,
760
+ "n07768694": 1019,
761
+ "n04033995": 1016,
762
+ "n03970156": 956,
763
+ "n02206856": 989,
764
+ "n07716906": 991,
765
+ "n04591713": 996,
766
+ "n03530642": 1002,
767
+ "n01795545": 997,
768
+ "n12144580": 1020,
769
+ "n03793489": 987,
770
+ "n03535780": 1004,
771
+ "n02105162": 999,
772
+ "n03372029": 1054,
773
+ "n02692877": 1017,
774
+ "n02190166": 1024,
775
+ "n07716358": 1024,
776
+ "n04592741": 1010,
777
+ "n07892512": 995,
778
+ "n01817953": 1027,
779
+ "n02117135": 1004,
780
+ "n01675722": 1031,
781
+ "n02086240": 1016,
782
+ "n03642806": 1021,
783
+ "n02099601": 1040,
784
+ "n02794156": 911,
785
+ "n03759954": 1035,
786
+ "n03028079": 1008,
787
+ "n07880968": 982,
788
+ "n01914609": 1007,
789
+ "n01667778": 1028,
790
+ "n01981276": 995,
791
+ "n02107312": 1026,
792
+ "n03763968": 1018,
793
+ "n04266014": 979,
794
+ "n02777292": 1024,
795
+ "n02669723": 1048,
796
+ "n04532106": 1021,
797
+ "n01537544": 1002,
798
+ "n03976467": 1008,
799
+ "n02033041": 1027,
800
+ "n02807133": 1003,
801
+ "n07718472": 989,
802
+ "n02676566": 1022,
803
+ "n04005630": 1019,
804
+ "n04069434": 1028,
805
+ "n01728920": 1011,
806
+ "n02101388": 1000,
807
+ "n02107908": 976,
808
+ "n03658185": 763,
809
+ "n04613696": 1016,
810
+ "n02870880": 1031,
811
+ "n02113023": 1015,
812
+ "n04336792": 1018,
813
+ "n02106030": 1020,
814
+ "n04239074": 1023,
815
+ "n03481172": 1016,
816
+ "n02066245": 900,
817
+ "n03188531": 1039,
818
+ "n03627232": 1022,
819
+ "n03595614": 1038,
820
+ "n03000247": 989,
821
+ "n03670208": 1006,
822
+ "n02319095": 1040,
823
+ "n03991062": 997,
824
+ "n09193705": 1015,
825
+ "n01819313": 1029,
826
+ "n02091467": 1025,
827
+ "n02095314": 757,
828
+ "n02490219": 1027,
829
+ "n03662601": 999,
830
+ "n01751748": 1002,
831
+ "n07714990": 1009,
832
+ "n02123159": 1016,
833
+ "n04355338": 1018,
834
+ "n02108422": 994,
835
+ "n03857828": 1028,
836
+ "n01882714": 994,
837
+ "n02356798": 941,
838
+ "n03476684": 1029,
839
+ "n02108089": 994,
840
+ "n01631663": 990,
841
+ "n02747177": 1008,
842
+ "n02097658": 1003,
843
+ "n04428191": 1009,
844
+ "n02094258": 975,
845
+ "n06785654": 1010,
846
+ "n02111889": 1027,
847
+ "n02109961": 1015,
848
+ "n02114855": 995,
849
+ "n04505470": 1002,
850
+ "n02037110": 1008,
851
+ "n04204238": 1024,
852
+ "n01632777": 1007,
853
+ "n07745940": 1034,
854
+ "n07613480": 1025,
855
+ "n02939185": 1028,
856
+ "n01955084": 978,
857
+ "n02974003": 1042,
858
+ "n03584254": 1037,
859
+ "n03840681": 1044,
860
+ "n02328150": 1011,
861
+ "n03000684": 948,
862
+ "n04258138": 1026,
863
+ "n07565083": 1021,
864
+ "n01704323": 994,
865
+ "n03775546": 1028,
866
+ "n02397096": 1014,
867
+ "n03459775": 1009,
868
+ "n03876231": 1016,
869
+ "n04591157": 956,
870
+ "n03240683": 1031,
871
+ "n02795169": 1038,
872
+ "n02486261": 1008,
873
+ "n02730930": 992,
874
+ "n03141823": 1003,
875
+ "n03485407": 802,
876
+ "n03998194": 1018,
877
+ "n02727426": 1017,
878
+ "n03873416": 1030,
879
+ "n03110669": 1016,
880
+ "n01773157": 1006,
881
+ "n01629819": 1025,
882
+ "n03599486": 1012,
883
+ "n04404412": 1004,
884
+ "n02815834": 1015,
885
+ "n01770393": 1033,
886
+ "n02120079": 1009,
887
+ "n02799071": 993,
888
+ "n02489166": 1043,
889
+ "n04590129": 1039,
890
+ "n01665541": 1031,
891
+ "n03314780": 907,
892
+ "n04332243": 1007,
893
+ "n04125021": 807,
894
+ "n01729322": 1024,
895
+ "n07714571": 1038,
896
+ "n02092339": 1035,
897
+ "n03594945": 1005,
898
+ "n02791124": 1036,
899
+ "n01514668": 1002,
900
+ "n02091244": 1015,
901
+ "n04049303": 1008,
902
+ "n04429376": 767,
903
+ "n02704792": 1046,
904
+ "n13054560": 1004,
905
+ "n03947888": 875,
906
+ "n03673027": 1041,
907
+ "n04152593": 841,
908
+ "n03133878": 947,
909
+ "n03838899": 1002,
910
+ "n07860988": 1013,
911
+ "n02089973": 573,
912
+ "n02167151": 974,
913
+ "n04399382": 1028,
914
+ "n03085013": 991,
915
+ "n02977058": 1007,
916
+ "n07920052": 1042,
917
+ "n02090721": 1029,
918
+ "n03944341": 895,
919
+ "n03690938": 977,
920
+ "n07734744": 1018,
921
+ "n02093991": 1007,
922
+ "n01484850": 1003,
923
+ "n04009552": 1034,
924
+ "n02992529": 999,
925
+ "n03938244": 1032,
926
+ "n02108551": 989,
927
+ "n02099267": 1011,
928
+ "n02106662": 1026,
929
+ "n04065272": 1019,
930
+ "n07717410": 1006,
931
+ "n04264628": 805,
932
+ "n02363005": 1012,
933
+ "n02089078": 575,
934
+ "n01630670": 1002,
935
+ "n03065424": 1030,
936
+ "n02930766": 1019,
937
+ "n02096437": 901,
938
+ "n01968897": 1006,
939
+ "n02102177": 1023,
940
+ "n02094114": 1021,
941
+ "n04238763": 904,
942
+ "n03995372": 721,
943
+ "n09468604": 1039,
944
+ "n03492542": 1030,
945
+ "n01983481": 1015,
946
+ "n13044778": 1033,
947
+ "n01496331": 1011,
948
+ "n12267677": 1023,
949
+ "n03534580": 1041,
950
+ "n01797886": 1040,
951
+ "n02097298": 1033,
952
+ "n02487347": 1002,
953
+ "n02927161": 1015,
954
+ "n02408429": 1011,
955
+ "n02128925": 1022,
956
+ "n01806567": 1006,
957
+ "n09256479": 1027,
958
+ "n03937543": 1013,
959
+ "n04540053": 1019,
960
+ "n01740131": 1012,
961
+ "n04033901": 1014,
962
+ "n03127747": 1030,
963
+ "n02871525": 1022,
964
+ "n09399592": 990,
965
+ "n04380533": 972,
966
+ "n04487394": 995,
967
+ "n03447447": 992,
968
+ "n07754684": 1020,
969
+ "n04131690": 1048,
970
+ "n03355925": 1024,
971
+ "n03977966": 1000,
972
+ "n02110063": 1038,
973
+ "n01688243": 888,
974
+ "n01753488": 993,
975
+ "n04090263": 958,
976
+ "n04346328": 1046,
977
+ "n03733281": 1012,
978
+ "n03325584": 1028,
979
+ "n03249569": 1004,
980
+ "n02894605": 1017,
981
+ "n01930112": 1029,
982
+ "n04389033": 1007,
983
+ "n03967562": 1031,
984
+ "n02108000": 910,
985
+ "n04141327": 1033,
986
+ "n04041544": 986,
987
+ "n02643566": 1017,
988
+ "n02009912": 1027,
989
+ "n04357314": 956,
990
+ "n06874185": 1025,
991
+ "n02804414": 1003,
992
+ "n04606251": 1025,
993
+ "n02112350": 1014,
994
+ "n02087046": 682,
995
+ "n02105855": 1023,
996
+ "n06359193": 1022,
997
+ "n07248320": 903,
998
+ "n03602883": 1010,
999
+ "n01729977": 1021,
1000
+ "n03854065": 1025,
1001
+ "n02110185": 972,
1002
+ "n03792782": 1012,
1003
+ "n04328186": 852,
1004
+ "n07802026": 1032,
1005
+ "n07695742": 996,
1006
+ "n03047690": 1037,
1007
+ "n03721384": 1015,
1008
+ "n07753113": 1034,
1009
+ "n04493381": 950,
1010
+ "n04579145": 808,
1011
+ "n01820546": 1024,
1012
+ "n02089867": 803,
1013
+ "n11939491": 1036,
1014
+ "n02123045": 1036,
1015
+ "n02113978": 587,
1016
+ "n01910747": 1026
1017
+ }
1018
+ },
1019
+ "queries": {
1020
+ "count": 10000,
1021
+ "source_split": "val",
1022
+ "radius_quantiles": [
1023
+ 0.1182835436163339,
1024
+ 0.12206400665691619,
1025
+ 0.12420704586466613,
1026
+ 0.12683785111084694,
1027
+ 0.12922320242162535,
1028
+ 0.13095104592302317,
1029
+ 0.13347441244527922
1030
+ ],
1031
+ "finite": true,
1032
+ "inside_ball": true,
1033
+ "class_counts": {}
1034
+ },
1035
+ "tuning_queries": {
1036
+ "count": 2000,
1037
+ "source_split": "val",
1038
+ "radius_quantiles": [
1039
+ 0.12039385023460057,
1040
+ 0.12186835291745816,
1041
+ 0.1242533979466059,
1042
+ 0.1268915200705385,
1043
+ 0.12934757393477678,
1044
+ 0.13107773396093414,
1045
+ 0.13291410828109335
1046
+ ],
1047
+ "finite": true,
1048
+ "inside_ball": true,
1049
+ "class_counts": {}
1050
+ }
1051
+ }
truth.u64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29f8527da3f0a19167cd4c0a08c659cd7cce178daabb02a887b5cbf96ae0de0d
3
+ size 800000
truth_complete.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "queries": {
3
+ "count": 10000,
4
+ "topk": 100,
5
+ "seconds": 7.384768594056368,
6
+ "method": "FP64 全扫描,按双曲代理距离与行号排序"
7
+ },
8
+ "tuning_queries": {
9
+ "count": 2000,
10
+ "topk": 100,
11
+ "seconds": 1.4547093510627747,
12
+ "method": "FP64 全扫描,按双曲代理距离与行号排序"
13
+ }
14
+ }
tuning_queries.f32 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fd4402ad74df5bd28afba4a1cf34b68aaa896950965b29f8cc788ecf44d21f1
3
+ size 4096000
tuning_queries_manifest.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e0b6abfad81abd9de652acf93081a138940b407cf667e7f8e342b946d46cf38
3
+ size 252507
tuning_queries_model_spatial.f32 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1360a715564e5d72480843467173a520de91c3231cd178c5d6f970f7cda5d77
3
+ size 4096000
tuning_queries_top100.u64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d5882665541c5fa02297f0da995d078b1a2814554ce9170f05c33cbcae6ddd86
3
+ size 1600000
tuning_queries_top100_distances.f64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:caad600d70162c774146742d264f28b432831ff04660daa6536bba9030fbea91
3
+ size 1600000
tuning_truth.u64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd3cf4c7fd1ce2ef7b039d41e1a2c344708aff76ea66aee91e65ee067fa0bb7e
3
+ size 160000
verification.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "complete": true,
3
+ "cpu_direct_difference_queries": [
4
+ 3115,
5
+ 3890,
6
+ 8474,
7
+ 6002,
8
+ 2495,
9
+ 4475,
10
+ 7002,
11
+ 1303,
12
+ 1105,
13
+ 3931,
14
+ 1952,
15
+ 4177,
16
+ 2405,
17
+ 2985,
18
+ 9799,
19
+ 8147
20
+ ],
21
+ "cpu_top100_equal": true,
22
+ "maximum_distance_error": 2.5673907444456745e-15,
23
+ "split_counts": [
24
+ 1000000,
25
+ 10000,
26
+ 2000
27
+ ],
28
+ "disjoint_ids": true
29
+ }