Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrify RawNet3/Resemblyzer as Keywords & Update READMEs #84

Closed

Conversation

Merakist
Copy link
Collaborator

@Merakist Merakist commented Jan 1, 2024

Description

This pull request includes modifications to further integrate Resemblyzer into Amphion's evaluation process, which includes:

  • Modifying the cosine similarity calculation method: Previously, the resemblyzer_similarity.py used the scipy.spatial.distance.cosine method for calculating cosine similarity. This update replaces it with PyTorch's torch.nn.functional.cosine_similarity method, which is already used by other scripts to simplify the codebase and ensure uniformity.

  • Metrifying RawNet3/Resemblyzer as keywords: Altered the --metrics argument handling from speaker_similarity to rawnet3_similarity and resemblyzer_similarity as distinct options to streamline the evaluation process by removing the need for user input during script execution.

Testing

  • The definitions of the scipy and torch method for calculating cosine similarity are intrinsically similar (See Documentations for SciPy and Torch). The results using both methods are calculated, and the difference between the two values is accurate to 7th decimal place, see Scipy - Torch Result Comparison. Therefore, the two methods are interchangeable with accuracies ensured.

Changes

  • Amphion/evaluation/metrics/similarity/resemblyzer_similarity.py:

    • Changed scipy.spatial.distance.cosine to torch.nn.functional.cosine_similarity method.
  • Amphion/bins/calc_metrics.py:

    • Altered speaker_similarity to two distinct options: rawnet3_similarity and resemblyzer_similarity.
  • Amphion/egs/metrics/README.md:

    • Updated Amphion's Evaluation Recipe to include Resemblyzer, replaced the speaker_similarity keyword with rawnet3_similarity and resemblyzer_similarity, and fixed misspelling.
  • Amphion/README.md:

    • Listing Resemblyzer as an available method for calculating speaker similarity results.

Usage

When calculating speaker similarity with Amphion/egs/metrics/run.sh using the command --metrics, the user shall select the desired model (RawNet3/Resemblyzer) for calculation with the corresponding keyword (rawnet3_similarity / resemblyzer_similarity).

@Merakist Merakist requested review from lmxue and RMSnow and removed request for lmxue and RMSnow January 1, 2024 10:31
@lmxue
Copy link
Collaborator

lmxue commented Jan 1, 2024

You should create a PR from a new branch and simplify the commit.

@Merakist Merakist closed this Jan 1, 2024
@Merakist Merakist deleted the resemblyzer-similarity-implementation branch January 1, 2024 13:47
@Merakist Merakist restored the resemblyzer-similarity-implementation branch January 1, 2024 13:47
@Merakist Merakist deleted the resemblyzer-similarity-implementation branch January 1, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants