Skip to content

Commit

Permalink
Updated scores json with all stem names
Browse files Browse the repository at this point in the history
  • Loading branch information
beveradb committed Dec 18, 2024
1 parent 297047c commit 6592f0c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 27 deletions.
48 changes: 24 additions & 24 deletions audio_separator/models-scores.json
Original file line number Diff line number Diff line change
Expand Up @@ -21276,33 +21276,13 @@
],
"target_stem": "instrumental"
},
"Reverb_HQ_By_FoxJoy.onnx": {
"model_name": "MDX-Net Model: Reverb HQ By FoxJoy",
"track_scores": [],
"median_scores": {},
"stems": [
"reverb",
"no reverb"
],
"target_stem": "reverb"
},
"UVR-MDX-NET_Crowd_HQ_1.onnx": {
"model_name": "MDX-Net Model: UVR-MDX-NET Crowd HQ 1 By Aufr33",
"track_scores": [],
"median_scores": {},
"stems": [
"no crowd",
"no no crowd"
],
"target_stem": "no crowd"
},
"17_HP-Wind_Inst-UVR.pth": {
"model_name": "VR Arch Single Model v5: 17_HP-Wind_Inst-UVR",
"track_scores": [],
"median_scores": {},
"stems": [
"no woodwinds",
"no no woodwinds"
"woodwinds"
],
"target_stem": "no woodwinds"
},
Expand All @@ -21312,7 +21292,7 @@
"median_scores": {},
"stems": [
"no echo",
"no no echo"
"echo"
],
"target_stem": "no echo"
},
Expand All @@ -21322,7 +21302,7 @@
"median_scores": {},
"stems": [
"no echo",
"no no echo"
"echo"
],
"target_stem": "no echo"
},
Expand All @@ -21332,7 +21312,7 @@
"median_scores": {},
"stems": [
"no reverb",
"no no reverb"
"reverb"
],
"target_stem": "no reverb"
},
Expand Down Expand Up @@ -21366,6 +21346,26 @@
],
"target_stem": "dry"
},
"Reverb_HQ_By_FoxJoy.onnx": {
"model_name": "MDX-Net Model: Reverb HQ By FoxJoy",
"track_scores": [],
"median_scores": {},
"stems": [
"reverb",
"no reverb"
],
"target_stem": "reverb"
},
"UVR-MDX-NET_Crowd_HQ_1.onnx": {
"model_name": "MDX-Net Model: UVR-MDX-NET Crowd HQ 1 By Aufr33",
"track_scores": [],
"median_scores": {},
"stems": [
"no crowd",
"crowd"
],
"target_stem": "no crowd"
},
"model_bs_roformer_ep_937_sdr_10.5309.ckpt": {
"model_name": "Roformer Model: BS-Roformer-Viperx-1053",
"track_scores": [],
Expand Down
32 changes: 29 additions & 3 deletions tests/model-metrics/test-all-models.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,53 +183,79 @@ def main():

# Iterate through models and load each one
for model_type, models in models_by_type.items():
logger.info(f"\nProcessing model type: {model_type}")
for model_name, model_info in models.items():
test_model = model_info.get("filename")
if not test_model:
logger.warning(f"No filename found for model {model_name}, skipping...")
continue

logger.info(f"Analyzing model data: {test_model}")
logger.info(f"\n=== Analyzing model: {model_name} (filename: {test_model}) ===")
try:
separator.load_model(model_filename=test_model)
model_data = separator.model_instance.model_data
logger.info(f"Raw model_data: {json.dumps(model_data, indent=2)}")

# Initialize model entry if it doesn't exist
if test_model not in combined_results:
logger.info(f"Initializing new entry for {test_model}")
combined_results[test_model] = {"model_name": model_name, "track_scores": [], "median_scores": {}, "stems": [], "target_stem": None}

# Handle demucs models specially
if test_model in DEMUCS_STEMS:
logger.info(f"Processing as Demucs model: {test_model}")
logger.info(f"Demucs config: {DEMUCS_STEMS[test_model]}")
combined_results[test_model]["stems"] = [s.lower() for s in DEMUCS_STEMS[test_model]["instruments"]]
combined_results[test_model]["target_stem"] = DEMUCS_STEMS[test_model]["target_instrument"].lower() if DEMUCS_STEMS[test_model]["target_instrument"] else None
logger.info(f"Set stems to: {combined_results[test_model]['stems']}")
logger.info(f"Set target_stem to: {combined_results[test_model]['target_stem']}")

# Extract stem information for other models
elif "training" in model_data:
logger.info("Processing model with training data")
instruments = model_data["training"].get("instruments", [])
target = model_data["training"].get("target_instrument")
logger.info(f"Found instruments: {instruments}")
logger.info(f"Found target: {target}")
combined_results[test_model]["stems"] = [s.lower() for s in instruments] if instruments else []
combined_results[test_model]["target_stem"] = target.lower() if target else None
logger.info(f"Set stems to: {combined_results[test_model]['stems']}")
logger.info(f"Set target_stem to: {combined_results[test_model]['target_stem']}")

elif "primary_stem" in model_data:
logger.info("Processing model with primary_stem")
primary_stem = model_data["primary_stem"].lower()
logger.info(f"Found primary_stem: {primary_stem}")

if primary_stem == "vocals":
other_stem = "instrumental"
elif primary_stem == "instrumental":
other_stem = "vocals"
else:
other_stem = "no " + primary_stem
if primary_stem.startswith("no "):
other_stem = primary_stem[3:] # Remove "no " prefix
else:
other_stem = "no " + primary_stem
logger.info(f"Determined other_stem: {other_stem}")

instruments = [primary_stem, other_stem]
combined_results[test_model]["stems"] = instruments
combined_results[test_model]["target_stem"] = primary_stem
logger.info(f"Set stems to: {combined_results[test_model]['stems']}")
logger.info(f"Set target_stem to: {combined_results[test_model]['target_stem']}")

else:
logger.warning(f"No recognized stem information found in model data for {test_model}")
combined_results[test_model]["stems"] = []
combined_results[test_model]["target_stem"] = None
logger.info("No stem information found in model data")

logger.info(f"Final model configuration for {test_model}:")
logger.info(f"Stems: {combined_results[test_model]['stems']}")
logger.info(f"Target stem: {combined_results[test_model]['target_stem']}")

except Exception as e:
logger.error(f"Error loading model {test_model}: {str(e)}")
logger.exception("Full exception details:")
continue

# Save the combined results after model inspection
Expand Down

0 comments on commit 6592f0c

Please sign in to comment.