Unified evaluation pipeline for version identification models
Extraction is now done from inside the corresponding model container by running extractor.py with the matching model name.
The input file must be a txt file with one absolute audio path per line (for example under /data/discogs/...).
Build and enter the CLEWS container:
make build-clews
make bash-clewsRun extraction inside the container:
python extractor/extractor.py --input extractor/path_test.txt --model clews --output-path output_embeddingsBuild and enter the Discogs-VINet container:
make build-discogs-vinet
make bash-discogs-vinetRun extraction inside the container:
python extractor/extractor.py --input extractor/path_test.txt --model discogs-vinet --output-path output_embeddingsNotes:
--inputpoints to a plain text file where each line is one audio file path.- Use
--model clewsonly in the CLEWS container and--model discogs-vinetonly in the Discogs-VINet container. - CLEWS writes
.ptembeddings. Discogs-VINet writes.npyembeddings. --output-pathis created automatically if it does not exist.
Build and enter the degradation container:
make build-degradation
make bash-degradationRun from the repo root on the host or inside the container:
python degradation/pitch_shift.py --input in.wav --output out_pitch.wav --n-steps 2
python degradation/time_stretch.py --input-path in_dir --output-path out_dir --stretch-rates 1.2
python degradation/reverb.py --input in.wav --output out_reverb.wav --mode algo --wet-level 0.4
python degradation/reverb.py --input in.wav --output out_reverb_ir.wav --mode ir --ir-path path/to/ir_or_ir_folder --wet-level 0.4Notes:
pitch_shift.pyandreverb.pyrequire--inputand--output.time_stretch.pyworks on directories via--input-pathand--output-path.- Docker usage follows the same pattern as the other services, for example:
docker compose run --rm degradation python degradation/pitch_shift.py --input /data/discogs/example.wav --output /data/discogs/example_pitch.wav --n-steps 2.
Run from the repo root:
python retrieval/eval_retrieval.py \
--first-list extractor/first_embeddings.txt \
--second-list extractor/second_embeddings.txt \
--embedding-model clews \
--metadata-json /data/discogs_test_subset.json \
--k 1 10 100 \
--verboseNotes:
--first-listis the database embeddings list.--second-listis the query embeddings list.--embedding-modelselects the retrieval configuration automatically:clews: dimension1024, metricl2discogs-vinet: dimension512, metricip, L2 normalization enabled
--metadata-jsonmust containversion_id -> [{youtube_id, ...}]mappings.- The script computes a pairwise score matrix using the model-specific retrieval config, then evaluates using
eval/eval.pymetrics: mAP, MR1, NAR, and R@K.
Run from the repo root:
python pipeline_orchestrator.py \
--input-json test-json.json \
--embedding-model discogs-vinet \
--enable-time-stretch-augmentation \
--time-stretch-rate 1.2 \
--docker-build-first \
--output-dir extractor/.pipeline_runtime/discogs_vinet_runWhat it does:
- Reads a JSON in the format
{work_id: [recording entries...]}. - Randomly chooses one recording per work for index and one for query.
- Optionally creates augmented query files (pitch shift or time stretch) and uses those augmented files as the only queries for evaluation.
- Runs embedding extraction with
extractor/extractor.py. - Builds index/query lists and evaluates retrieval with mAP, MR1, NAR, and R@K.
- Prints metrics and saves a full JSON report.
Notes:
- Recording entries must be strings (audio paths) or dicts with
path/audio_path/recording_path/file_path/filepath. - Relative paths in the JSON are resolved from the repository root.
- The script always runs extraction with
docker compose run --rm <service> python extractor/extractor.py .... - The script runs retrieval evaluation in Docker too:
docker compose run --rm retrieval python retrieval/eval_retrieval.py .... --enable-pitch-shift-augmentationappliesdegradation/pitch_shift.pyto each selected query and evaluates retrieval using only the augmented queries.--pitch-shift-n-stepscontrols semitone shift for pitch-shifted query files.--enable-time-stretch-augmentationappliesdegradation/time_stretch.pyto each selected query and evaluates retrieval using only the augmented queries.--time-stretch-ratecontrols time-stretch factor for time-stretched query files.- Use only one augmentation mode per run (
--enable-pitch-shift-augmentationor--enable-time-stretch-augmentation). - Use
--docker-build-firstif you want to rebuild the model image before extraction. --output-dirmust be insideextractor/so container and host share generated files.- The script automatically writes embeddings to
<output-dir>/embeddingsand report JSON to<output-dir>/report.json. - If
<output-dir>/embeddingsalready contains extracted files, only missing embeddings are extracted. - Augmented query files are written under
extractor/.pipeline_runtime/<run>/augmented_queriesand are automatically converted to/app/extractor/...paths for the extractor container.
retrieval/eval_retrieval.py is modularized and supports:
--embedding-modelto select dimension/metric/normalization from the model name.--metadata-jsonfor the original metadata format.--labels-jsonfor explicitembedding_stem -> {work_id, song_id}labels.--output-jsonto save metrics/details for orchestration.