Commit 69843933 69843933efecfbfff4cdcfcfb1b3eb0329384489 by cnb.bofCdSsphPA

Add a FAISS-first local ACR workflow for music20 samples

Constraint: local validation should stay lightweight and use /workspace sample files while production retrieval remains pgvector-backed
Rejected: making ChromaDB the default local backend | chromadb is not installed in the current environment and FAISS is already available
Confidence: high
Scope-risk: narrow
Directive: keep local dev workflows explicitly separated from production pgvector flows in docs and scripts
Tested: /usr/local/miniconda3/bin/python -m unittest discover -s acr-engine/tests -v; /usr/local/miniconda3/bin/python acr-engine/scripts/local_music20_acr.py --downloads-dir /workspace/downloads --song-limit 20 --backend faiss --output acr-engine/data/local_eval/music20_summary.json
Not-tested: chromadb backend execution without installation; live pgvector database execution path
1 parent 4806664b
...@@ -94,6 +94,29 @@ cd acr-engine ...@@ -94,6 +94,29 @@ cd acr-engine
94 python evaluate.py --data data/synthetic --model data/models/best_model.pt --index-prefix data/index/reference --split test --device cpu 94 python evaluate.py --data data/synthetic --model data/models/best_model.pt --index-prefix data/index/reference --split test --device cpu
95 ``` 95 ```
96 96
97 ## 本地 20 首歌流程与生产向量库约定
98
99 - 本地小样本(如 `/workspace/downloads` 的 20 首歌流程)优先使用 **FAISS**
100 - 若后续本机安装了 `chromadb`,可作为可选对照后端,但不是默认依赖。
101 - 生产环境统一保留 **pgvector** 作为正式向量存储与检索底座。
102
103 本地 20 首歌流程:
104
105 ```bash
106 cd acr-engine
107 /usr/local/miniconda3/bin/python scripts/local_music20_acr.py \
108 --downloads-dir /workspace/downloads \
109 --song-limit 20 \
110 --backend faiss \
111 --output data/local_eval/music20_summary.json
112 ```
113
114 说明:
115 - `query_type=1/7/8/16` 会在一个汇总 JSON 里统一输出。
116 - 默认本地后端为 `faiss`
117 - 若使用 `--backend chromadb` 且环境缺少 `chromadb`,脚本会明确报错提示。
118 - 生产向量化链路仍走 `scripts/export_manifest_to_pgvector_json.py` 与后续 pgvector 入库。
119
97 ## 当前提升方向 120 ## 当前提升方向
98 121
99 - 更强合成混淆样本(confused / humming_like) 122 - 更强合成混淆样本(confused / humming_like)
......
1 {
2 "backend": "faiss",
3 "purpose": "Local 20-song ACR sanity flow for development; production remains pgvector.",
4 "downloads_dir": "/workspace/downloads",
5 "song_limit": 20,
6 "duration_sec": 8.0,
7 "sr": 22050,
8 "evaluations": [
9 {
10 "query_type": 1,
11 "reference_type": 11,
12 "song_count": 20,
13 "file_count": 40,
14 "topk": 3,
15 "metrics": {
16 "top1": 1.0,
17 "top3": 1.0
18 },
19 "results": [
20 {
21 "song_id": "100",
22 "query_path": "/workspace/downloads/100/type_1/BQ0000095-1.mp3",
23 "reference_path": "/workspace/downloads/100/type_11/93dfdeb0-7da5-42a8-9c71-cf12af57dd191650256918.wav",
24 "rank": 1,
25 "candidates": [
26 {
27 "rank": 1,
28 "song_id": "100",
29 "score": 0.9999855160713196
30 },
31 {
32 "rank": 2,
33 "song_id": "116",
34 "score": 0.9527432918548584
35 },
36 {
37 "rank": 3,
38 "song_id": "103",
39 "score": 0.9517078399658203
40 }
41 ]
42 },
43 {
44 "song_id": "101",
45 "query_path": "/workspace/downloads/101/type_1/7679087a-c16c-4d0f-851f-b10f61b2032d1650364264.mp3",
46 "reference_path": "/workspace/downloads/101/type_11/83c0c07f-4f96-4ff4-998c-58db910f3cfa1650256915.wav",
47 "rank": 1,
48 "candidates": [
49 {
50 "rank": 1,
51 "song_id": "101",
52 "score": 0.9999996423721313
53 },
54 {
55 "rank": 2,
56 "song_id": "118",
57 "score": 0.9811710715293884
58 },
59 {
60 "rank": 3,
61 "song_id": "116",
62 "score": 0.9800198078155518
63 }
64 ]
65 },
66 {
67 "song_id": "102",
68 "query_path": "/workspace/downloads/102/type_1/8fd5d3e8-e214-4d07-a283-1c5f6ac061f21650376142.mp3",
69 "reference_path": "/workspace/downloads/102/type_11/43440ec5-70b4-4d50-8683-d3e41cad29411650256908.wav",
70 "rank": 1,
71 "candidates": [
72 {
73 "rank": 1,
74 "song_id": "102",
75 "score": 0.9999971389770508
76 },
77 {
78 "rank": 2,
79 "song_id": "113",
80 "score": 0.9651333093643188
81 },
82 {
83 "rank": 3,
84 "song_id": "118",
85 "score": 0.9586168527603149
86 }
87 ]
88 },
89 {
90 "song_id": "103",
91 "query_path": "/workspace/downloads/103/type_1/BQ0000092-1.mp3",
92 "reference_path": "/workspace/downloads/103/type_11/19876dbb-fffc-40f8-9530-9322c9ed77681650256912.wav",
93 "rank": 1,
94 "candidates": [
95 {
96 "rank": 1,
97 "song_id": "103",
98 "score": 0.9976630210876465
99 },
100 {
101 "rank": 2,
102 "song_id": "116",
103 "score": 0.9769654273986816
104 },
105 {
106 "rank": 3,
107 "song_id": "109",
108 "score": 0.965166449546814
109 }
110 ]
111 },
112 {
113 "song_id": "104",
114 "query_path": "/workspace/downloads/104/type_1/BQ0000091-1.mp3",
115 "reference_path": "/workspace/downloads/104/type_11/4c1d3e22-045f-445b-ab87-ba1ae3ee09b31650256912.wav",
116 "rank": 1,
117 "candidates": [
118 {
119 "rank": 1,
120 "song_id": "104",
121 "score": 0.999987781047821
122 },
123 {
124 "rank": 2,
125 "song_id": "109",
126 "score": 0.9496555328369141
127 },
128 {
129 "rank": 3,
130 "song_id": "116",
131 "score": 0.9238482713699341
132 }
133 ]
134 },
135 {
136 "song_id": "105",
137 "query_path": "/workspace/downloads/105/type_1/BQ0000090-1.mp3",
138 "reference_path": "/workspace/downloads/105/type_11/57e61cde-4410-4751-93e9-d7a4ecece5791650256910.wav",
139 "rank": 1,
140 "candidates": [
141 {
142 "rank": 1,
143 "song_id": "105",
144 "score": 0.9999495148658752
145 },
146 {
147 "rank": 2,
148 "song_id": "106",
149 "score": 0.9606355428695679
150 },
151 {
152 "rank": 3,
153 "song_id": "116",
154 "score": 0.944517195224762
155 }
156 ]
157 },
158 {
159 "song_id": "106",
160 "query_path": "/workspace/downloads/106/type_1/BQ0000089-1.mp3",
161 "reference_path": "/workspace/downloads/106/type_11/bf61426c-67b7-4cf1-a9e7-f78cf519a0021650256910.wav",
162 "rank": 1,
163 "candidates": [
164 {
165 "rank": 1,
166 "song_id": "106",
167 "score": 0.9999995231628418
168 },
169 {
170 "rank": 2,
171 "song_id": "105",
172 "score": 0.9609931707382202
173 },
174 {
175 "rank": 3,
176 "song_id": "114",
177 "score": 0.9195822477340698
178 }
179 ]
180 },
181 {
182 "song_id": "107",
183 "query_path": "/workspace/downloads/107/type_1/BQ0000088-1.mp3",
184 "reference_path": "/workspace/downloads/107/type_11/296bbc25-617c-4368-9a69-357aeec394381650256910.wav",
185 "rank": 1,
186 "candidates": [
187 {
188 "rank": 1,
189 "song_id": "107",
190 "score": 0.9978529810905457
191 },
192 {
193 "rank": 2,
194 "song_id": "116",
195 "score": 0.9719059467315674
196 },
197 {
198 "rank": 3,
199 "song_id": "101",
200 "score": 0.9612845182418823
201 }
202 ]
203 },
204 {
205 "song_id": "108",
206 "query_path": "/workspace/downloads/108/type_1/BQ0000087-1.mp3",
207 "reference_path": "/workspace/downloads/108/type_11/d7e28fe6-4ad6-4243-b66b-d90ff5ca1e491650256909.wav",
208 "rank": 1,
209 "candidates": [
210 {
211 "rank": 1,
212 "song_id": "108",
213 "score": 0.9989668726921082
214 },
215 {
216 "rank": 2,
217 "song_id": "117",
218 "score": 0.931882381439209
219 },
220 {
221 "rank": 3,
222 "song_id": "116",
223 "score": 0.9296072721481323
224 }
225 ]
226 },
227 {
228 "song_id": "109",
229 "query_path": "/workspace/downloads/109/type_1/d47d92f7-a39d-4e83-b5a2-05f98f3b74b3.mp3",
230 "reference_path": "/workspace/downloads/109/type_11/84acef9b-2a74-44bc-9eff-5ca7969ac9b61650256909.wav",
231 "rank": 1,
232 "candidates": [
233 {
234 "rank": 1,
235 "song_id": "109",
236 "score": 0.9808862209320068
237 },
238 {
239 "rank": 2,
240 "song_id": "116",
241 "score": 0.9763683676719666
242 },
243 {
244 "rank": 3,
245 "song_id": "103",
246 "score": 0.9724475741386414
247 }
248 ]
249 },
250 {
251 "song_id": "110",
252 "query_path": "/workspace/downloads/110/type_1/BQ0000085-1.mp3",
253 "reference_path": "/workspace/downloads/110/type_11/2197b39e-23e2-4a66-b07e-dd672eab214a1650256908.wav",
254 "rank": 1,
255 "candidates": [
256 {
257 "rank": 1,
258 "song_id": "110",
259 "score": 0.9998435378074646
260 },
261 {
262 "rank": 2,
263 "song_id": "107",
264 "score": 0.9448647499084473
265 },
266 {
267 "rank": 3,
268 "song_id": "109",
269 "score": 0.9418830275535583
270 }
271 ]
272 },
273 {
274 "song_id": "111",
275 "query_path": "/workspace/downloads/111/type_1/BQ0000084-1.mp3",
276 "reference_path": "/workspace/downloads/111/type_11/7f5256e8-de5f-41c5-bf76-419e05df72d81650256908.wav",
277 "rank": 1,
278 "candidates": [
279 {
280 "rank": 1,
281 "song_id": "111",
282 "score": 0.9993308186531067
283 },
284 {
285 "rank": 2,
286 "song_id": "110",
287 "score": 0.924956738948822
288 },
289 {
290 "rank": 3,
291 "song_id": "107",
292 "score": 0.913865327835083
293 }
294 ]
295 },
296 {
297 "song_id": "112",
298 "query_path": "/workspace/downloads/112/type_1/BQ0000083-1.mp3",
299 "reference_path": "/workspace/downloads/112/type_11/34acd523-3c01-443d-ac3d-4ad7b9e2246f1650256907.wav",
300 "rank": 1,
301 "candidates": [
302 {
303 "rank": 1,
304 "song_id": "112",
305 "score": 0.9999276399612427
306 },
307 {
308 "rank": 2,
309 "song_id": "118",
310 "score": 0.9651827216148376
311 },
312 {
313 "rank": 3,
314 "song_id": "101",
315 "score": 0.9411808848381042
316 }
317 ]
318 },
319 {
320 "song_id": "113",
321 "query_path": "/workspace/downloads/113/type_1/BQ0000082-1.mp3",
322 "reference_path": "/workspace/downloads/113/type_11/6d9438af-5d83-434b-bb20-76e28d0bbc4e1650256907.wav",
323 "rank": 1,
324 "candidates": [
325 {
326 "rank": 1,
327 "song_id": "113",
328 "score": 0.999977707862854
329 },
330 {
331 "rank": 2,
332 "song_id": "102",
333 "score": 0.9643173217773438
334 },
335 {
336 "rank": 3,
337 "song_id": "118",
338 "score": 0.9469178915023804
339 }
340 ]
341 },
342 {
343 "song_id": "114",
344 "query_path": "/workspace/downloads/114/type_1/BQ0000081-1.mp3",
345 "reference_path": "/workspace/downloads/114/type_11/0238ecbf-b234-470e-82e4-f3b80a267d771650256906.wav",
346 "rank": 1,
347 "candidates": [
348 {
349 "rank": 1,
350 "song_id": "114",
351 "score": 0.9999734163284302
352 },
353 {
354 "rank": 2,
355 "song_id": "109",
356 "score": 0.9544920325279236
357 },
358 {
359 "rank": 3,
360 "song_id": "116",
361 "score": 0.9441098570823669
362 }
363 ]
364 },
365 {
366 "song_id": "115",
367 "query_path": "/workspace/downloads/115/type_1/BQ0000080-1.mp3",
368 "reference_path": "/workspace/downloads/115/type_11/aabad0ff-13de-4786-aa9c-40e1f957ed9f1650256906.wav",
369 "rank": 1,
370 "candidates": [
371 {
372 "rank": 1,
373 "song_id": "115",
374 "score": 0.999998927116394
375 },
376 {
377 "rank": 2,
378 "song_id": "109",
379 "score": 0.9597340822219849
380 },
381 {
382 "rank": 3,
383 "song_id": "116",
384 "score": 0.9441829919815063
385 }
386 ]
387 },
388 {
389 "song_id": "116",
390 "query_path": "/workspace/downloads/116/type_1/BQ0000079-1.mp3",
391 "reference_path": "/workspace/downloads/116/type_11/da34f6ff-39e7-4dde-8265-e1bb01b6263e1650256901.wav",
392 "rank": 1,
393 "candidates": [
394 {
395 "rank": 1,
396 "song_id": "116",
397 "score": 0.9999432563781738
398 },
399 {
400 "rank": 2,
401 "song_id": "109",
402 "score": 0.9809496998786926
403 },
404 {
405 "rank": 3,
406 "song_id": "101",
407 "score": 0.9800974130630493
408 }
409 ]
410 },
411 {
412 "song_id": "117",
413 "query_path": "/workspace/downloads/117/type_1/BQ0000078-1.mp3",
414 "reference_path": "/workspace/downloads/117/type_11/1e1599e6-ebbd-4ceb-a81d-a320331ef6e31650256901.wav",
415 "rank": 1,
416 "candidates": [
417 {
418 "rank": 1,
419 "song_id": "117",
420 "score": 0.9999651312828064
421 },
422 {
423 "rank": 2,
424 "song_id": "118",
425 "score": 0.9473282098770142
426 },
427 {
428 "rank": 3,
429 "song_id": "101",
430 "score": 0.9408854246139526
431 }
432 ]
433 },
434 {
435 "song_id": "118",
436 "query_path": "/workspace/downloads/118/type_1/BQ0000077-1.mp3",
437 "reference_path": "/workspace/downloads/118/type_11/db64461e-d752-4cf3-ab1d-56ff9232823d1650256901.wav",
438 "rank": 1,
439 "candidates": [
440 {
441 "rank": 1,
442 "song_id": "118",
443 "score": 0.9999653100967407
444 },
445 {
446 "rank": 2,
447 "song_id": "101",
448 "score": 0.9815313816070557
449 },
450 {
451 "rank": 3,
452 "song_id": "116",
453 "score": 0.9717569351196289
454 }
455 ]
456 },
457 {
458 "song_id": "119",
459 "query_path": "/workspace/downloads/119/type_1/BQ0000076-1.mp3",
460 "reference_path": "/workspace/downloads/119/type_11/180dfa7d-836a-449c-990f-a3bf39c11da11650256898.wav",
461 "rank": 1,
462 "candidates": [
463 {
464 "rank": 1,
465 "song_id": "119",
466 "score": 0.9999881982803345
467 },
468 {
469 "rank": 2,
470 "song_id": "109",
471 "score": 0.974808394908905
472 },
473 {
474 "rank": 3,
475 "song_id": "118",
476 "score": 0.9480958580970764
477 }
478 ]
479 }
480 ]
481 },
482 {
483 "query_type": 7,
484 "reference_type": 11,
485 "song_count": 20,
486 "file_count": 40,
487 "topk": 3,
488 "metrics": {
489 "top1": 0.45,
490 "top3": 0.65
491 },
492 "results": [
493 {
494 "song_id": "111",
495 "query_path": "/workspace/downloads/111/type_7/75cd601b-7604-4b37-8132-cfab39e7c644.mp3",
496 "reference_path": "/workspace/downloads/111/type_11/7f5256e8-de5f-41c5-bf76-419e05df72d81650256908.wav",
497 "rank": 4,
498 "candidates": [
499 {
500 "rank": 1,
501 "song_id": "1566",
502 "score": 0.967636227607727
503 },
504 {
505 "rank": 2,
506 "song_id": "116",
507 "score": 0.9610425233840942
508 },
509 {
510 "rank": 3,
511 "song_id": "1232",
512 "score": 0.9582047462463379
513 }
514 ]
515 },
516 {
517 "song_id": "116",
518 "query_path": "/workspace/downloads/116/type_7/d7098db6-fed3-485f-906e-e55e42187f0c.mp3",
519 "reference_path": "/workspace/downloads/116/type_11/da34f6ff-39e7-4dde-8265-e1bb01b6263e1650256901.wav",
520 "rank": 1,
521 "candidates": [
522 {
523 "rank": 1,
524 "song_id": "116",
525 "score": 0.9527724981307983
526 },
527 {
528 "rank": 2,
529 "song_id": "1411",
530 "score": 0.9431514739990234
531 },
532 {
533 "rank": 3,
534 "song_id": "1551",
535 "score": 0.9387646913528442
536 }
537 ]
538 },
539 {
540 "song_id": "1232",
541 "query_path": "/workspace/downloads/1232/type_7/0bf7dd0a-c761-4695-ae48-f3eb19606e66.mp3",
542 "reference_path": "/workspace/downloads/1232/type_11/2a9e9334-a6da-4229-be28-dfd3d74ac8001650256614.wav",
543 "rank": 1,
544 "candidates": [
545 {
546 "rank": 1,
547 "song_id": "1232",
548 "score": 0.9828177690505981
549 },
550 {
551 "rank": 2,
552 "song_id": "1529",
553 "score": 0.9734008312225342
554 },
555 {
556 "rank": 3,
557 "song_id": "127",
558 "score": 0.9728921055793762
559 }
560 ]
561 },
562 {
563 "song_id": "1248",
564 "query_path": "/workspace/downloads/1248/type_7/67db54b7-7d5d-45f5-a502-089c3d9ae768.mp3",
565 "reference_path": "/workspace/downloads/1248/type_11/9b5ec70a-ebec-4053-b983-8dde96fd35931650256654.wav",
566 "rank": 1,
567 "candidates": [
568 {
569 "rank": 1,
570 "song_id": "1248",
571 "score": 0.9654114842414856
572 },
573 {
574 "rank": 2,
575 "song_id": "1557",
576 "score": 0.9396299123764038
577 },
578 {
579 "rank": 3,
580 "song_id": "1413",
581 "score": 0.9305849075317383
582 }
583 ]
584 },
585 {
586 "song_id": "127",
587 "query_path": "/workspace/downloads/127/type_7/c2a6df6f-53fb-498c-ba9e-9c235858afdb.mp3",
588 "reference_path": "/workspace/downloads/127/type_11/0f7c2e4e-7adc-4574-99a2-d9ba16ac91751650256886.wav",
589 "rank": 4,
590 "candidates": [
591 {
592 "rank": 1,
593 "song_id": "1538",
594 "score": 0.9620548486709595
595 },
596 {
597 "rank": 2,
598 "song_id": "1557",
599 "score": 0.9539428949356079
600 },
601 {
602 "rank": 3,
603 "song_id": "1248",
604 "score": 0.9378949403762817
605 }
606 ]
607 },
608 {
609 "song_id": "139",
610 "query_path": "/workspace/downloads/139/type_7/cdfb0c16-ded3-4ea0-950d-aad9db32a623.mp3",
611 "reference_path": "/workspace/downloads/139/type_11/26701fc6-0649-4c25-9027-8569f3ccd8c31650256860.wav",
612 "rank": 1,
613 "candidates": [
614 {
615 "rank": 1,
616 "song_id": "139",
617 "score": 0.9671847820281982
618 },
619 {
620 "rank": 2,
621 "song_id": "1524",
622 "score": 0.9634047746658325
623 },
624 {
625 "rank": 3,
626 "song_id": "1551",
627 "score": 0.9607867002487183
628 }
629 ]
630 },
631 {
632 "song_id": "1411",
633 "query_path": "/workspace/downloads/1411/type_7/11c9c322-4f9a-4352-98c4-45676571ad0f.mp3",
634 "reference_path": "/workspace/downloads/1411/type_11/9a95c2e7-9eb4-4961-b77d-3f7a3db509e31650256687.wav",
635 "rank": 1,
636 "candidates": [
637 {
638 "rank": 1,
639 "song_id": "1411",
640 "score": 0.9772824645042419
641 },
642 {
643 "rank": 2,
644 "song_id": "149",
645 "score": 0.9645872116088867
646 },
647 {
648 "rank": 3,
649 "song_id": "1551",
650 "score": 0.9318547248840332
651 }
652 ]
653 },
654 {
655 "song_id": "1413",
656 "query_path": "/workspace/downloads/1413/type_7/0809e02c-ef1a-4cb3-a157-7d68ce80f450.mp3",
657 "reference_path": "/workspace/downloads/1413/type_11/c1837d1f-3580-42ed-a421-6bee7d7deeed1650256690.wav",
658 "rank": 3,
659 "candidates": [
660 {
661 "rank": 1,
662 "song_id": "1538",
663 "score": 0.9844843149185181
664 },
665 {
666 "rank": 2,
667 "song_id": "1557",
668 "score": 0.9749652743339539
669 },
670 {
671 "rank": 3,
672 "song_id": "1413",
673 "score": 0.9692580699920654
674 }
675 ]
676 },
677 {
678 "song_id": "1417",
679 "query_path": "/workspace/downloads/1417/type_7/d810f778-a5f5-4361-bc98-8a1f0dacc436.mp3",
680 "reference_path": "/workspace/downloads/1417/type_11/a0ccdd48-9b17-4f10-8326-1f7cd3a482371650256706.wav",
681 "rank": 1,
682 "candidates": [
683 {
684 "rank": 1,
685 "song_id": "1417",
686 "score": 0.9710202217102051
687 },
688 {
689 "rank": 2,
690 "song_id": "139",
691 "score": 0.9527145624160767
692 },
693 {
694 "rank": 3,
695 "song_id": "1524",
696 "score": 0.9493513703346252
697 }
698 ]
699 },
700 {
701 "song_id": "144",
702 "query_path": "/workspace/downloads/144/type_7/f24ab0b1-eb00-46b1-ba20-95f67f7e46aa.mp3",
703 "reference_path": "/workspace/downloads/144/type_11/59d8f5ce-3446-4d07-b2fe-b9e92d6c27d61650256849.wav",
704 "rank": 4,
705 "candidates": [
706 {
707 "rank": 1,
708 "song_id": "1566",
709 "score": 0.8859690427780151
710 },
711 {
712 "rank": 2,
713 "song_id": "1248",
714 "score": 0.8855512142181396
715 },
716 {
717 "rank": 3,
718 "song_id": "1529",
719 "score": 0.880099892616272
720 }
721 ]
722 },
723 {
724 "song_id": "146",
725 "query_path": "/workspace/downloads/146/type_7/5b36aaa4-ee1e-4a4e-850f-7b11e4ea6ead.mp3",
726 "reference_path": "/workspace/downloads/146/type_11/6d1d68c0-c4f4-4619-a6d5-1a3663977df71650256843.wav",
727 "rank": 4,
728 "candidates": [
729 {
730 "rank": 1,
731 "song_id": "116",
732 "score": 0.9712613224983215
733 },
734 {
735 "rank": 2,
736 "song_id": "1538",
737 "score": 0.96543288230896
738 },
739 {
740 "rank": 3,
741 "song_id": "139",
742 "score": 0.9634105563163757
743 }
744 ]
745 },
746 {
747 "song_id": "149",
748 "query_path": "/workspace/downloads/149/type_7/a5edfa85-901f-48b4-84b7-5dbf95e6abe6.mp3",
749 "reference_path": "/workspace/downloads/149/type_11/a2bd0149-1656-443b-a462-935a06038bff1650256842.wav",
750 "rank": 1,
751 "candidates": [
752 {
753 "rank": 1,
754 "song_id": "149",
755 "score": 0.9712207913398743
756 },
757 {
758 "rank": 2,
759 "song_id": "1411",
760 "score": 0.9420245885848999
761 },
762 {
763 "rank": 3,
764 "song_id": "1551",
765 "score": 0.9403735399246216
766 }
767 ]
768 },
769 {
770 "song_id": "1524",
771 "query_path": "/workspace/downloads/1524/type_7/1230164367-6195b2805c6c8.mp3",
772 "reference_path": "/workspace/downloads/1524/type_11/2112741450-6195b26c7b221.wav",
773 "rank": 2,
774 "candidates": [
775 {
776 "rank": 1,
777 "song_id": "1413",
778 "score": 0.954952597618103
779 },
780 {
781 "rank": 2,
782 "song_id": "1524",
783 "score": 0.9472723007202148
784 },
785 {
786 "rank": 3,
787 "song_id": "139",
788 "score": 0.9455631971359253
789 }
790 ]
791 },
792 {
793 "song_id": "1529",
794 "query_path": "/workspace/downloads/1529/type_7/3057076667-6195b157c8452.mp3",
795 "reference_path": "/workspace/downloads/1529/type_11/3318666279-6195b1453bb4c.wav",
796 "rank": 4,
797 "candidates": [
798 {
799 "rank": 1,
800 "song_id": "1557",
801 "score": 0.9849310517311096
802 },
803 {
804 "rank": 2,
805 "song_id": "1538",
806 "score": 0.978501558303833
807 },
808 {
809 "rank": 3,
810 "song_id": "116",
811 "score": 0.9784452319145203
812 }
813 ]
814 },
815 {
816 "song_id": "1538",
817 "query_path": "/workspace/downloads/1538/type_7/0819b4cc-a233-4af2-809a-ab05c0ac7776.mp3",
818 "reference_path": "/workspace/downloads/1538/type_11/1453349980-6195b1de8e835.wav",
819 "rank": 2,
820 "candidates": [
821 {
822 "rank": 1,
823 "song_id": "1413",
824 "score": 0.9892231822013855
825 },
826 {
827 "rank": 2,
828 "song_id": "1538",
829 "score": 0.9782330989837646
830 },
831 {
832 "rank": 3,
833 "song_id": "1524",
834 "score": 0.9660094380378723
835 }
836 ]
837 },
838 {
839 "song_id": "1551",
840 "query_path": "/workspace/downloads/1551/type_7/6377f532-0433-4197-9605-9aca077b26cf.mp3",
841 "reference_path": "/workspace/downloads/1551/type_11/2797850860-619b6d38c9947.wav",
842 "rank": 1,
843 "candidates": [
844 {
845 "rank": 1,
846 "song_id": "1551",
847 "score": 0.9460268020629883
848 },
849 {
850 "rank": 2,
851 "song_id": "139",
852 "score": 0.9309369325637817
853 },
854 {
855 "rank": 3,
856 "song_id": "1524",
857 "score": 0.9213981628417969
858 }
859 ]
860 },
861 {
862 "song_id": "1555",
863 "query_path": "/workspace/downloads/1555/type_7/27ea0429-ac91-4a9d-99c0-aa4206d9bb09.mp3",
864 "reference_path": "/workspace/downloads/1555/type_11/1594992616-6195b1ba75f86.wav",
865 "rank": 4,
866 "candidates": [
867 {
868 "rank": 1,
869 "song_id": "139",
870 "score": 0.9818602800369263
871 },
872 {
873 "rank": 2,
874 "song_id": "1417",
875 "score": 0.9796779155731201
876 },
877 {
878 "rank": 3,
879 "song_id": "1524",
880 "score": 0.9765959978103638
881 }
882 ]
883 },
884 {
885 "song_id": "1557",
886 "query_path": "/workspace/downloads/1557/type_7/b3f58fb7-fd7f-4171-89e5-03c4af249913.mp3",
887 "reference_path": "/workspace/downloads/1557/type_11/半抹烟熏 - 封茗囧菌.wav",
888 "rank": 3,
889 "candidates": [
890 {
891 "rank": 1,
892 "song_id": "1529",
893 "score": 0.9679929614067078
894 },
895 {
896 "rank": 2,
897 "song_id": "116",
898 "score": 0.9472056031227112
899 },
900 {
901 "rank": 3,
902 "song_id": "1557",
903 "score": 0.9455881118774414
904 }
905 ]
906 },
907 {
908 "song_id": "1566",
909 "query_path": "/workspace/downloads/1566/type_7/11d4a0c3-c61a-42fd-8e05-6a5ec5d6def8.mp3",
910 "reference_path": "/workspace/downloads/1566/type_11/203038478-619b71a87115d.wav",
911 "rank": 1,
912 "candidates": [
913 {
914 "rank": 1,
915 "song_id": "1566",
916 "score": 0.9815737009048462
917 },
918 {
919 "rank": 2,
920 "song_id": "1557",
921 "score": 0.9664562344551086
922 },
923 {
924 "rank": 3,
925 "song_id": "1232",
926 "score": 0.9642168283462524
927 }
928 ]
929 },
930 {
931 "song_id": "1569",
932 "query_path": "/workspace/downloads/1569/type_7/2a1013ef-c90a-49fc-98c1-1fc440913eb0.mp3",
933 "reference_path": "/workspace/downloads/1569/type_11/4036702771-619b70a7e7878.wav",
934 "rank": 4,
935 "candidates": [
936 {
937 "rank": 1,
938 "song_id": "1417",
939 "score": 0.9472358226776123
940 },
941 {
942 "rank": 2,
943 "song_id": "1551",
944 "score": 0.9437472820281982
945 },
946 {
947 "rank": 3,
948 "song_id": "139",
949 "score": 0.9431149363517761
950 }
951 ]
952 }
953 ]
954 },
955 {
956 "query_type": 8,
957 "reference_type": 11,
958 "song_count": 15,
959 "file_count": 30,
960 "topk": 3,
961 "metrics": {
962 "top1": 0.4666666666666667,
963 "top3": 0.7333333333333333
964 },
965 "results": [
966 {
967 "song_id": "567134",
968 "query_path": "/workspace/downloads/567134/type_8/忘记自己 第一段副歌剪辑.wav",
969 "reference_path": "/workspace/downloads/567134/type_11/忘记自己 MMM.wav",
970 "rank": 4,
971 "candidates": [
972 {
973 "rank": 1,
974 "song_id": "567138",
975 "score": 0.9597984552383423
976 },
977 {
978 "rank": 2,
979 "song_id": "567281",
980 "score": 0.9574185013771057
981 },
982 {
983 "rank": 3,
984 "song_id": "567271",
985 "score": 0.9435654878616333
986 }
987 ]
988 },
989 {
990 "song_id": "567138",
991 "query_path": "/workspace/downloads/567138/type_8/小宝贝推广片段.mp3",
992 "reference_path": "/workspace/downloads/567138/type_11/小宝贝(手鼓版)_晴天姐妹_OK版.wav",
993 "rank": 2,
994 "candidates": [
995 {
996 "rank": 1,
997 "song_id": "567264",
998 "score": 0.9656863808631897
999 },
1000 {
1001 "rank": 2,
1002 "song_id": "567138",
1003 "score": 0.9656082391738892
1004 },
1005 {
1006 "rank": 3,
1007 "song_id": "567259",
1008 "score": 0.9642202854156494
1009 }
1010 ]
1011 },
1012 {
1013 "song_id": "567165",
1014 "query_path": "/workspace/downloads/567165/type_8/送你一片夏天的海(副歌版).mp3",
1015 "reference_path": "/workspace/downloads/567165/type_11/苏北北-送你一片夏天的海.wav",
1016 "rank": 4,
1017 "candidates": [
1018 {
1019 "rank": 1,
1020 "song_id": "567179",
1021 "score": 0.9562718868255615
1022 },
1023 {
1024 "rank": 2,
1025 "song_id": "567264",
1026 "score": 0.9513835310935974
1027 },
1028 {
1029 "rank": 3,
1030 "song_id": "567916",
1031 "score": 0.9498939514160156
1032 }
1033 ]
1034 },
1035 {
1036 "song_id": "567179",
1037 "query_path": "/workspace/downloads/567179/type_8/要多久-剪辑版2.mp3",
1038 "reference_path": "/workspace/downloads/567179/type_11/王泽科-要多久-MMM.wav",
1039 "rank": 1,
1040 "candidates": [
1041 {
1042 "rank": 1,
1043 "song_id": "567179",
1044 "score": 0.9795538187026978
1045 },
1046 {
1047 "rank": 2,
1048 "song_id": "567916",
1049 "score": 0.9502705335617065
1050 },
1051 {
1052 "rank": 3,
1053 "song_id": "567138",
1054 "score": 0.9405353665351868
1055 }
1056 ]
1057 },
1058 {
1059 "song_id": "567189",
1060 "query_path": "/workspace/downloads/567189/type_8/晚风的颜色(主歌).mp3",
1061 "reference_path": "/workspace/downloads/567189/type_11/李淼淼&嘿人李逵Noisemakers-晚风的颜色 MMM.wav",
1062 "rank": 1,
1063 "candidates": [
1064 {
1065 "rank": 1,
1066 "song_id": "567189",
1067 "score": 0.9632946252822876
1068 },
1069 {
1070 "rank": 2,
1071 "song_id": "567138",
1072 "score": 0.9404645562171936
1073 },
1074 {
1075 "rank": 3,
1076 "song_id": "567916",
1077 "score": 0.9360995888710022
1078 }
1079 ]
1080 },
1081 {
1082 "song_id": "567201",
1083 "query_path": "/workspace/downloads/567201/type_8/勇敢 副歌2 (3).wav",
1084 "reference_path": "/workspace/downloads/567201/type_11/勇敢MMM Final .wav",
1085 "rank": 1,
1086 "candidates": [
1087 {
1088 "rank": 1,
1089 "song_id": "567201",
1090 "score": 0.9567320942878723
1091 },
1092 {
1093 "rank": 2,
1094 "song_id": "567259",
1095 "score": 0.9491016864776611
1096 },
1097 {
1098 "rank": 3,
1099 "song_id": "567271",
1100 "score": 0.9226593375205994
1101 }
1102 ]
1103 },
1104 {
1105 "song_id": "567239",
1106 "query_path": "/workspace/downloads/567239/type_8/这个夏天怎么可以没有你 推广片段2(开头主歌).mp3",
1107 "reference_path": "/workspace/downloads/567239/type_11/这个夏天怎么可以没有你 MMM.wav",
1108 "rank": 2,
1109 "candidates": [
1110 {
1111 "rank": 1,
1112 "song_id": "567264",
1113 "score": 0.9888042211532593
1114 },
1115 {
1116 "rank": 2,
1117 "song_id": "567239",
1118 "score": 0.9758810997009277
1119 },
1120 {
1121 "rank": 3,
1122 "song_id": "567916",
1123 "score": 0.9709678888320923
1124 }
1125 ]
1126 },
1127 {
1128 "song_id": "567259",
1129 "query_path": "/workspace/downloads/567259/type_8/天宫一日游 推广片段2.mp3",
1130 "reference_path": "/workspace/downloads/567259/type_11/天宫一日游 NEW MMM9.wav",
1131 "rank": 1,
1132 "candidates": [
1133 {
1134 "rank": 1,
1135 "song_id": "567259",
1136 "score": 0.9787400960922241
1137 },
1138 {
1139 "rank": 2,
1140 "song_id": "567271",
1141 "score": 0.9783401489257812
1142 },
1143 {
1144 "rank": 3,
1145 "song_id": "567264",
1146 "score": 0.9548755884170532
1147 }
1148 ]
1149 },
1150 {
1151 "song_id": "567263",
1152 "query_path": "/workspace/downloads/567263/type_8/如果我们不能在一起(主歌2).mp3",
1153 "reference_path": "/workspace/downloads/567263/type_11/韩小欠-如果我们不能在一起.wav",
1154 "rank": 4,
1155 "candidates": [
1156 {
1157 "rank": 1,
1158 "song_id": "567271",
1159 "score": 0.9618159532546997
1160 },
1161 {
1162 "rank": 2,
1163 "song_id": "567259",
1164 "score": 0.9609355926513672
1165 },
1166 {
1167 "rank": 3,
1168 "song_id": "567134",
1169 "score": 0.9573717713356018
1170 }
1171 ]
1172 },
1173 {
1174 "song_id": "567264",
1175 "query_path": "/workspace/downloads/567264/type_8/如果我们不能在一起(DJheap九天版)副歌.mp3",
1176 "reference_path": "/workspace/downloads/567264/type_11/韩小欠 - 如果我们不能在一起(DJheap九天版).wav",
1177 "rank": 1,
1178 "candidates": [
1179 {
1180 "rank": 1,
1181 "song_id": "567264",
1182 "score": 0.9920860528945923
1183 },
1184 {
1185 "rank": 2,
1186 "song_id": "567916",
1187 "score": 0.9885831475257874
1188 },
1189 {
1190 "rank": 3,
1191 "song_id": "567239",
1192 "score": 0.9782738089561462
1193 }
1194 ]
1195 },
1196 {
1197 "song_id": "567271",
1198 "query_path": "/workspace/downloads/567271/type_8/时光寄语(带前缀进副).wav",
1199 "reference_path": "/workspace/downloads/567271/type_11/时光寄语_MMM.wav",
1200 "rank": 1,
1201 "candidates": [
1202 {
1203 "rank": 1,
1204 "song_id": "567271",
1205 "score": 0.9909964203834534
1206 },
1207 {
1208 "rank": 2,
1209 "song_id": "567259",
1210 "score": 0.9836105108261108
1211 },
1212 {
1213 "rank": 3,
1214 "song_id": "567138",
1215 "score": 0.9572499990463257
1216 }
1217 ]
1218 },
1219 {
1220 "song_id": "567281",
1221 "query_path": "/workspace/downloads/567281/type_8/赵乾景-野火春风(剪辑版2).wav",
1222 "reference_path": "/workspace/downloads/567281/type_11/赵乾景-野火春风-MMM.wav",
1223 "rank": 4,
1224 "candidates": [
1225 {
1226 "rank": 1,
1227 "song_id": "567418",
1228 "score": 0.9464678168296814
1229 },
1230 {
1231 "rank": 2,
1232 "song_id": "567179",
1233 "score": 0.9336224794387817
1234 },
1235 {
1236 "rank": 3,
1237 "song_id": "567138",
1238 "score": 0.9211266040802002
1239 }
1240 ]
1241 },
1242 {
1243 "song_id": "567415",
1244 "query_path": "/workspace/downloads/567415/type_8/将相(主歌版).mp3",
1245 "reference_path": "/workspace/downloads/567415/type_11/海伦-将相.wav",
1246 "rank": 2,
1247 "candidates": [
1248 {
1249 "rank": 1,
1250 "song_id": "567239",
1251 "score": 0.9695478677749634
1252 },
1253 {
1254 "rank": 2,
1255 "song_id": "567415",
1256 "score": 0.9663351774215698
1257 },
1258 {
1259 "rank": 3,
1260 "song_id": "567264",
1261 "score": 0.9626679420471191
1262 }
1263 ]
1264 },
1265 {
1266 "song_id": "567418",
1267 "query_path": "/workspace/downloads/567418/type_8/寒鸦 副歌片段.mp3",
1268 "reference_path": "/workspace/downloads/567418/type_11/阿YueYue-寒鸦.wav",
1269 "rank": 2,
1270 "candidates": [
1271 {
1272 "rank": 1,
1273 "song_id": "567179",
1274 "score": 0.9723362922668457
1275 },
1276 {
1277 "rank": 2,
1278 "song_id": "567418",
1279 "score": 0.957268476486206
1280 },
1281 {
1282 "rank": 3,
1283 "song_id": "567138",
1284 "score": 0.9490213394165039
1285 }
1286 ]
1287 },
1288 {
1289 "song_id": "567916",
1290 "query_path": "/workspace/downloads/567916/type_8/梁祝 2022【长片段】.mp3",
1291 "reference_path": "/workspace/downloads/567916/type_11/李智恩_ 有余-梁祝2022【MMM】.wav",
1292 "rank": 1,
1293 "candidates": [
1294 {
1295 "rank": 1,
1296 "song_id": "567916",
1297 "score": 0.9856635332107544
1298 },
1299 {
1300 "rank": 2,
1301 "song_id": "567264",
1302 "score": 0.978611946105957
1303 },
1304 {
1305 "rank": 3,
1306 "song_id": "567239",
1307 "score": 0.9704344272613525
1308 }
1309 ]
1310 }
1311 ]
1312 },
1313 {
1314 "query_type": 16,
1315 "reference_type": 11,
1316 "song_count": 12,
1317 "file_count": 24,
1318 "topk": 3,
1319 "metrics": {
1320 "top1": 0.4166666666666667,
1321 "top3": 0.4166666666666667
1322 },
1323 "results": [
1324 {
1325 "song_id": "569681",
1326 "query_path": "/workspace/downloads/569681/type_16/失去的总是太珍贵(DJ版)_15秒.wav",
1327 "reference_path": "/workspace/downloads/569681/type_11/b208a400b27f8ce254786084db610591.wav",
1328 "rank": 1,
1329 "candidates": [
1330 {
1331 "rank": 1,
1332 "song_id": "569681",
1333 "score": 0.9956467151641846
1334 },
1335 {
1336 "rank": 2,
1337 "song_id": "570345",
1338 "score": 0.9810035228729248
1339 },
1340 {
1341 "rank": 3,
1342 "song_id": "570690",
1343 "score": 0.9807205200195312
1344 }
1345 ]
1346 },
1347 {
1348 "song_id": "569738",
1349 "query_path": "/workspace/downloads/569738/type_16/孤单被写成歌 (DJ阿卓版)-剪辑版.mp3",
1350 "reference_path": "/workspace/downloads/569738/type_11/54d71a3a1dd75528d07f301288833bea.wav",
1351 "rank": 1,
1352 "candidates": [
1353 {
1354 "rank": 1,
1355 "song_id": "569738",
1356 "score": 0.9825096130371094
1357 },
1358 {
1359 "rank": 2,
1360 "song_id": "571113",
1361 "score": 0.965214729309082
1362 },
1363 {
1364 "rank": 3,
1365 "song_id": "569681",
1366 "score": 0.9526969790458679
1367 }
1368 ]
1369 },
1370 {
1371 "song_id": "569748",
1372 "query_path": "/workspace/downloads/569748/type_16/49a1d25ec19ace09e80b81187ebb0d0b.mp3",
1373 "reference_path": "/workspace/downloads/569748/type_11/98293d1ced1538afeaac8fb2d0627450.wav",
1374 "rank": 4,
1375 "candidates": [
1376 {
1377 "rank": 1,
1378 "song_id": "570690",
1379 "score": 0.9810636639595032
1380 },
1381 {
1382 "rank": 2,
1383 "song_id": "569681",
1384 "score": 0.9782453775405884
1385 },
1386 {
1387 "rank": 3,
1388 "song_id": "570345",
1389 "score": 0.9706552028656006
1390 }
1391 ]
1392 },
1393 {
1394 "song_id": "569787",
1395 "query_path": "/workspace/downloads/569787/type_16/九块九爱情-副歌剪辑.mp3",
1396 "reference_path": "/workspace/downloads/569787/type_11/cd311b412dcf2022d4f3218ff9ff2a0e.wav",
1397 "rank": 4,
1398 "candidates": [
1399 {
1400 "rank": 1,
1401 "song_id": "569681",
1402 "score": 0.9725706577301025
1403 },
1404 {
1405 "rank": 2,
1406 "song_id": "570345",
1407 "score": 0.9703218936920166
1408 },
1409 {
1410 "rank": 3,
1411 "song_id": "570690",
1412 "score": 0.9670296311378479
1413 }
1414 ]
1415 },
1416 {
1417 "song_id": "569855",
1418 "query_path": "/workspace/downloads/569855/type_16/2604aa1e31c47097c27ef92e7993aa5e.mp3",
1419 "reference_path": "/workspace/downloads/569855/type_11/fd7b9d0ad38ed4a1e8781c024f9e98a3.wav",
1420 "rank": 4,
1421 "candidates": [
1422 {
1423 "rank": 1,
1424 "song_id": "569681",
1425 "score": 0.9718084335327148
1426 },
1427 {
1428 "rank": 2,
1429 "song_id": "571113",
1430 "score": 0.9617775082588196
1431 },
1432 {
1433 "rank": 3,
1434 "song_id": "570690",
1435 "score": 0.9604461193084717
1436 }
1437 ]
1438 },
1439 {
1440 "song_id": "570124",
1441 "query_path": "/workspace/downloads/570124/type_16/朋友的礼貌 推广音频_01.wav",
1442 "reference_path": "/workspace/downloads/570124/type_11/49558365b2b2dc4407d57bae50042538.wav",
1443 "rank": 1,
1444 "candidates": [
1445 {
1446 "rank": 1,
1447 "song_id": "570124",
1448 "score": 0.9759569764137268
1449 },
1450 {
1451 "rank": 2,
1452 "song_id": "569681",
1453 "score": 0.9457025527954102
1454 },
1455 {
1456 "rank": 3,
1457 "song_id": "571113",
1458 "score": 0.9330494403839111
1459 }
1460 ]
1461 },
1462 {
1463 "song_id": "570345",
1464 "query_path": "/workspace/downloads/570345/type_16/痴情小丑-副歌剪辑.mp3",
1465 "reference_path": "/workspace/downloads/570345/type_11/fef15d6a43a89238ef4c2f0a11da4bdc.wav",
1466 "rank": 4,
1467 "candidates": [
1468 {
1469 "rank": 1,
1470 "song_id": "571113",
1471 "score": 0.9789301753044128
1472 },
1473 {
1474 "rank": 2,
1475 "song_id": "570615",
1476 "score": 0.9712299108505249
1477 },
1478 {
1479 "rank": 3,
1480 "song_id": "569748",
1481 "score": 0.9703583717346191
1482 }
1483 ]
1484 },
1485 {
1486 "song_id": "570386",
1487 "query_path": "/workspace/downloads/570386/type_16/eda281acb45e7ee372120854feae9949.mp3",
1488 "reference_path": "/workspace/downloads/570386/type_11/3f329c9cbaa2ac2612040712bfa1fa09.wav",
1489 "rank": 4,
1490 "candidates": [
1491 {
1492 "rank": 1,
1493 "song_id": "569748",
1494 "score": 0.978370726108551
1495 },
1496 {
1497 "rank": 2,
1498 "song_id": "569787",
1499 "score": 0.9759876728057861
1500 },
1501 {
1502 "rank": 3,
1503 "song_id": "571113",
1504 "score": 0.9739384651184082
1505 }
1506 ]
1507 },
1508 {
1509 "song_id": "570612",
1510 "query_path": "/workspace/downloads/570612/type_16/刘彧轩-怕-推广片段.mp3",
1511 "reference_path": "/workspace/downloads/570612/type_11/f7e3172620f2ed5830055d9d9e15da0d.wav",
1512 "rank": 4,
1513 "candidates": [
1514 {
1515 "rank": 1,
1516 "song_id": "569681",
1517 "score": 0.959099292755127
1518 },
1519 {
1520 "rank": 2,
1521 "song_id": "571113",
1522 "score": 0.9577440023422241
1523 },
1524 {
1525 "rank": 3,
1526 "song_id": "569738",
1527 "score": 0.9569077491760254
1528 }
1529 ]
1530 },
1531 {
1532 "song_id": "570615",
1533 "query_path": "/workspace/downloads/570615/type_16/故事打烊 片段.mp3",
1534 "reference_path": "/workspace/downloads/570615/type_11/8fe62b2057640446295f901d0fc8c668.wav",
1535 "rank": 4,
1536 "candidates": [
1537 {
1538 "rank": 1,
1539 "song_id": "571113",
1540 "score": 0.971631646156311
1541 },
1542 {
1543 "rank": 2,
1544 "song_id": "569738",
1545 "score": 0.959520697593689
1546 },
1547 {
1548 "rank": 3,
1549 "song_id": "569748",
1550 "score": 0.9524401426315308
1551 }
1552 ]
1553 },
1554 {
1555 "song_id": "570690",
1556 "query_path": "/workspace/downloads/570690/type_16/ca8e0c234e560d89d98b52eefc50728b.mp3",
1557 "reference_path": "/workspace/downloads/570690/type_11/456050c584f93f406a10bc67979482bb.wav",
1558 "rank": 1,
1559 "candidates": [
1560 {
1561 "rank": 1,
1562 "song_id": "570690",
1563 "score": 0.992263674736023
1564 },
1565 {
1566 "rank": 2,
1567 "song_id": "569681",
1568 "score": 0.9891844987869263
1569 },
1570 {
1571 "rank": 3,
1572 "song_id": "571113",
1573 "score": 0.9690903425216675
1574 }
1575 ]
1576 },
1577 {
1578 "song_id": "571113",
1579 "query_path": "/workspace/downloads/571113/type_16/杨小壮-《痴情小丑》伯格DJ版-副歌.wav",
1580 "reference_path": "/workspace/downloads/571113/type_11/4a568a7e0dbd2566b219af738e9fded9.wav",
1581 "rank": 1,
1582 "candidates": [
1583 {
1584 "rank": 1,
1585 "song_id": "571113",
1586 "score": 0.9814494848251343
1587 },
1588 {
1589 "rank": 2,
1590 "song_id": "569681",
1591 "score": 0.9789079427719116
1592 },
1593 {
1594 "rank": 3,
1595 "song_id": "570345",
1596 "score": 0.9653943777084351
1597 }
1598 ]
1599 }
1600 ]
1601 }
1602 ]
1603 }
...\ No newline at end of file ...\ No newline at end of file
1 #!/usr/bin/env /usr/local/miniconda3/bin/python
2 """Run a FAISS-first local ACR eval on up to 20 songs from /workspace/downloads.
3
4 Purpose:
5 - keep small-sample validation inside acr-engine
6 - default to FAISS for local dev
7 - optionally allow ChromaDB when installed
8 - preserve pgvector as the production path (not used here)
9 """
10 from __future__ import annotations
11
12 import argparse
13 import json
14 from pathlib import Path
15 from typing import Dict, List
16
17 import faiss
18 import librosa
19 import numpy as np
20
21
22 DEFAULT_DOWNLOADS = Path('/workspace/downloads')
23 DEFAULT_OUTPUT = Path('/root/vprecog/acr-engine/data/local_eval/music20_summary.json')
24 SUPPORTED_QUERY_TYPES = (1, 7, 8, 16)
25 REFERENCE_TYPE = 11
26
27
28 def parse_args() -> argparse.Namespace:
29 ap = argparse.ArgumentParser()
30 ap.add_argument('--downloads-dir', default=str(DEFAULT_DOWNLOADS))
31 ap.add_argument('--song-limit', type=int, default=20)
32 ap.add_argument('--duration', type=float, default=8.0)
33 ap.add_argument('--sr', type=int, default=22050)
34 ap.add_argument('--topk', type=int, default=3)
35 ap.add_argument('--backend', choices=['faiss', 'chromadb'], default='faiss')
36 ap.add_argument('--output', default=str(DEFAULT_OUTPUT))
37 return ap.parse_args()
38
39
40 def first_file(path: Path) -> Path | None:
41 files = sorted(p for p in path.iterdir() if p.is_file()) if path.exists() else []
42 return files[0] if files else None
43
44
45 def collect_pairs(downloads_dir: Path, song_limit: int, query_type: int) -> List[Dict[str, str]]:
46 pairs = []
47 for song_dir in sorted(p for p in downloads_dir.iterdir() if p.is_dir()):
48 ref = first_file(song_dir / f'type_{REFERENCE_TYPE}')
49 qry = first_file(song_dir / f'type_{query_type}')
50 if ref and qry:
51 pairs.append({
52 'song_id': song_dir.name,
53 'reference_path': str(ref),
54 'query_path': str(qry),
55 })
56 if len(pairs) >= song_limit:
57 break
58 return pairs
59
60
61 def load_audio(path: str, sr: int, duration: float) -> np.ndarray:
62 y, _ = librosa.load(path, sr=sr, mono=True, duration=duration)
63 target_len = int(sr * duration)
64 if len(y) < target_len:
65 y = np.pad(y, (0, target_len - len(y)))
66 else:
67 y = y[:target_len]
68 return y.astype(np.float32)
69
70
71 def embed_chroma(path: str, sr: int, duration: float) -> np.ndarray:
72 y = load_audio(path, sr=sr, duration=duration)
73 chroma = librosa.feature.chroma_stft(y=y, sr=sr, n_chroma=12)
74 feat = np.concatenate([chroma.mean(axis=1), chroma.std(axis=1)], axis=0).astype(np.float32)
75 norm = np.linalg.norm(feat)
76 if norm > 0:
77 feat = feat / norm
78 return feat
79
80
81 def run_faiss(ref_matrix: np.ndarray, qry_matrix: np.ndarray, topk: int):
82 index = faiss.IndexFlatIP(ref_matrix.shape[1])
83 index.add(ref_matrix)
84 return index.search(qry_matrix, topk)
85
86
87 def run_chromadb(ref_matrix: np.ndarray, qry_matrix: np.ndarray, topk: int):
88 try:
89 import chromadb # type: ignore
90 except Exception as exc: # pragma: no cover - env-dependent
91 raise SystemExit(f'ChromaDB backend requested but unavailable: {exc}')
92
93 client = chromadb.EphemeralClient()
94 collection = client.create_collection('music20_local_eval')
95 ref_ids = [str(i) for i in range(len(ref_matrix))]
96 collection.add(ids=ref_ids, embeddings=ref_matrix.tolist())
97 result = collection.query(query_embeddings=qry_matrix.tolist(), n_results=topk)
98 distances = np.asarray(result['distances'], dtype=np.float32)
99 idxs = np.asarray([[int(x) for x in row] for row in result['ids']], dtype=np.int32)
100 sims = 1.0 - distances
101 return sims, idxs
102
103
104 def evaluate_query_type(downloads_dir: Path, song_limit: int, query_type: int, sr: int, duration: float, topk: int, backend: str):
105 pairs = collect_pairs(downloads_dir, song_limit, query_type=query_type)
106 if not pairs:
107 return {
108 'query_type': query_type,
109 'reference_type': REFERENCE_TYPE,
110 'song_count': 0,
111 'file_count': 0,
112 'topk': topk,
113 'metrics': {'top1': 0.0, 'top3': 0.0},
114 'results': [],
115 'note': 'No matching query/reference pairs found.',
116 }
117
118 ref_vecs = [embed_chroma(item['reference_path'], sr, duration) for item in pairs]
119 qry_vecs = [embed_chroma(item['query_path'], sr, duration) for item in pairs]
120 ref_ids = [item['song_id'] for item in pairs]
121
122 ref_matrix = np.vstack(ref_vecs).astype(np.float32)
123 qry_matrix = np.vstack(qry_vecs).astype(np.float32)
124
125 if backend == 'faiss':
126 sims, idxs = run_faiss(ref_matrix, qry_matrix, topk)
127 else:
128 sims, idxs = run_chromadb(ref_matrix, qry_matrix, topk)
129
130 ranks = []
131 results = []
132 for i, item in enumerate(pairs):
133 candidates = []
134 rank = None
135 for j in range(topk):
136 ref_idx = int(idxs[i, j])
137 cand_song_id = ref_ids[ref_idx]
138 score = float(sims[i, j])
139 candidates.append({'rank': j + 1, 'song_id': cand_song_id, 'score': score})
140 if cand_song_id == item['song_id'] and rank is None:
141 rank = j + 1
142 if rank is None:
143 rank = topk + 1
144 ranks.append(rank)
145 results.append({
146 'song_id': item['song_id'],
147 'query_path': item['query_path'],
148 'reference_path': item['reference_path'],
149 'rank': rank,
150 'candidates': candidates,
151 })
152
153 top1 = sum(1 for r in ranks if r == 1) / len(ranks)
154 top3 = sum(1 for r in ranks if r <= min(3, topk)) / len(ranks)
155 return {
156 'query_type': query_type,
157 'reference_type': REFERENCE_TYPE,
158 'song_count': len(pairs),
159 'file_count': len(pairs) * 2,
160 'topk': topk,
161 'metrics': {'top1': top1, 'top3': top3},
162 'results': results,
163 }
164
165
166 def main() -> None:
167 args = parse_args()
168 downloads_dir = Path(args.downloads_dir)
169 out = Path(args.output)
170 out.parent.mkdir(parents=True, exist_ok=True)
171
172 summary = {
173 'backend': args.backend,
174 'purpose': 'Local 20-song ACR sanity flow for development; production remains pgvector.',
175 'downloads_dir': str(downloads_dir),
176 'song_limit': args.song_limit,
177 'duration_sec': args.duration,
178 'sr': args.sr,
179 'evaluations': [],
180 }
181 for query_type in SUPPORTED_QUERY_TYPES:
182 summary['evaluations'].append(
183 evaluate_query_type(downloads_dir, args.song_limit, query_type, args.sr, args.duration, args.topk, args.backend)
184 )
185
186 out.write_text(json.dumps(summary, ensure_ascii=False, indent=2), encoding='utf-8')
187 print(json.dumps(summary, ensure_ascii=False, indent=2))
188
189
190 if __name__ == '__main__':
191 main()
1 import tempfile
2 import unittest
3 from pathlib import Path
4
5 from scripts.local_music20_acr import collect_pairs, first_file
6
7
8 class LocalMusic20AcrTests(unittest.TestCase):
9 def test_first_file_returns_none_for_missing_dir(self):
10 with tempfile.TemporaryDirectory() as tmp:
11 self.assertIsNone(first_file(Path(tmp) / 'missing'))
12
13 def test_collect_pairs_uses_reference_and_query_types(self):
14 with tempfile.TemporaryDirectory() as tmp:
15 root = Path(tmp)
16 song = root / '1'
17 (song / 'type_11').mkdir(parents=True)
18 (song / 'type_7').mkdir(parents=True)
19 ((song / 'type_11') / 'ref.wav').write_bytes(b'r')
20 ((song / 'type_7') / 'query.mp3').write_bytes(b'q')
21
22 pairs = collect_pairs(root, song_limit=20, query_type=7)
23
24 self.assertEqual(len(pairs), 1)
25 self.assertEqual(pairs[0]['song_id'], '1')
26 self.assertTrue(pairs[0]['reference_path'].endswith('ref.wav'))
27 self.assertTrue(pairs[0]['query_path'].endswith('query.mp3'))
28
29
30 if __name__ == '__main__':
31 unittest.main()
1
2 ## 2026-06-03 20-song local ACR workflow in acr-engine
3
4 - 新增 `acr-engine/scripts/local_music20_acr.py`,在 `acr-engine` 内提供基于 `/workspace/downloads` 的本地 20 首歌 ACR 小样本流程。
5 - 本地流程默认优先使用 **FAISS**`chromadb` 作为可选对照后端;生产环境继续保留 **pgvector**
6 - 新增 `acr-engine/tests/test_local_music20_acr.py`,覆盖本地配对逻辑。
7 - 新增 `acr-engine/data/local_eval/music20_summary.json`,记录 `type_1/7/8/16 -> type_11` 的本地 20-song 汇总结果。
8 - 更新 `acr-engine/README.md`,明确“本地 FAISS / 可选 ChromaDB / 生产 pgvector”的分层约定。
9
10 Fresh evidence:
11 - `/usr/local/miniconda3/bin/python -m unittest discover -s acr-engine/tests -v` => `Ran 2 tests, OK`
12 - `/usr/local/miniconda3/bin/python acr-engine/scripts/local_music20_acr.py --downloads-dir /workspace/downloads --song-limit 20 --backend faiss --output acr-engine/data/local_eval/music20_summary.json` 跑通
13 - 汇总结果:
14 - `type_1 -> type_11`: `top1=1.0`, `top3=1.0`
15 - `type_7 -> type_11`: `top1=0.45`, `top3=0.65`
16 - `type_8 -> type_11`: `top1=0.4667`, `top3=0.7333`
17 - `type_16 -> type_11`: `top1=0.4167`, `top3=0.4167`
18
1 ### Stage: production encoder freeze FAQ and rollout guidance 19 ### Stage: production encoder freeze FAQ and rollout guidance
2 20
3 完成项: 21 完成项:
......