Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 50adafb
  • /
  • egs
  • /
  • metrics
  • /
  • run.sh
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:47d735ef577c90175b8a9e9055bc9fd5d94311de
directory badge Iframe embedding
swh:1:dir:f2f88a4cad500439cdba5df9e4a211a1d62a9916

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
run.sh
# Copyright (c) 2023 Amphion.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

######## Build Experiment Environment ###########
exp_dir=$(cd `dirname $0`; pwd)
work_dir=$(dirname $(dirname $exp_dir))

export WORK_DIR=$work_dir
export PYTHONPATH=$work_dir
export PYTHONIOENCODING=UTF-8

######## Parse the Given Parameters from the Commond ###########
options=$(getopt -o c:n:s --long gpu:,reference_folder:,generated_folder:,dump_folder:,metrics:,fs:,align_method:,energy_db_scale:,f0_subtract_mean:,similarity_model:,similarity_mode:,ltr_path:,intelligibility_mode:,language: -- "$@")
eval set -- "$options"

while true; do
  case $1 in
    # Visible GPU machines. The default value is "0".
    --gpu) shift; gpu=$1 ; shift ;;
    # Reference Audio Folder
    --reference_folder) shift; ref_dir=$1 ; shift ;;
    # Generated Audio Folder
    --generated_folder) shift; deg_dir=$1 ; shift ;;
    # Result Dumping Folder
    --dump_folder) shift; dump_dir=$1 ; shift ;;
    # Metrics to Compute
    --metrics) shift; metrics=$1 ; shift ;;
    # Sampling Rate
    --fs) shift; fs=$1 ; shift ;;

    # Method for aligning F0. The default value is "cut"
    --align_method) shift; align_method=$1 ; shift ;;
    # Method for normalizing F0. The default value is "True"
    --f0_subtract_mean) shift; f0_subtract_mean=$1 ; shift ;;
    # Method for normalizing Energy. The default value is "True"
    --energy_db_scale) shift; energy_db_scale=$1 ; shift ;;

    # Model for computing speaker similarity. The default value is "wavlm"
    --similarity_model) shift; similarity_model=$1 ; shift ;;
    # Mode for computing speaker similarity. The default value is "pairwith"
    --similarity_mode) shift; similarity_mode=$1 ; shift ;;
    
    # Path for the transcript.
    --ltr_path) shift; ltr_path=$1 ; shift ;;
    # Mode for computing CER and WER. The default value is "gt_audio"
    --intelligibility_mode) shift; intelligibility_mode=$1 ; shift ;;
    # Language for computing CER and WER. The default value is "english"
    --language) shift; language=$1 ; shift ;;

    --) shift ; break ;;
    *) echo "Invalid option: $1" exit 1 ;;
  esac
done

### Value check ###
if [ -z "$ref_dir" ]; then
    echo "[Error] Please specify the reference_folder"
    exit 1
fi

if [ -z "$deg_dir" ]; then
    echo "[Error] Please specify the generated_folder"
    exit 1
fi

if [ -z "$dump_dir" ]; then
    echo "[Error] Please specify the dump_folder"
    exit 1
fi

if [ -z "$metrics" ]; then
    echo "[Error] Please specify the metrics"
    exit 1
fi

if [ -z "$gpu" ]; then
    gpu="0"
fi

if [ -z "$fs" ]; then
    fs="None"
fi

if [ -z "$align_method" ]; then
    align_method="dtw"
fi

if [ -z "$energy_db_scale" ]; then
    energy_db_scale="True"
fi

if [ -z "$f0_subtract_mean" ]; then
    f0_subtract_mean="True"
fi

if [ -z "$similarity_model" ]; then
    similarity_model="wavlm"
fi

if [ -z "$similarity_mode" ]; then
    similarity_mode="pairwith"
fi

if [ -z "$ltr_path" ]; then
    ltr_path="None"
fi

if [ -z "$intelligibility_mode" ]; then
    intelligibility_mode="gt_audio"
fi

if [ -z "$language" ]; then
    language="english"
fi

######## Calculate Objective Metrics ###########
CUDA_VISIBLE_DEVICES=$gpu python "$work_dir"/bins/calc_metrics.py \
    --ref_dir $ref_dir \
    --deg_dir $deg_dir \
    --dump_dir $dump_dir \
    --metrics $metrics \
    --fs $fs \
    --align_method $align_method \
    --db_scale $energy_db_scale \
    --f0_subtract_mean $f0_subtract_mean \
    --similarity_model $similarity_model \
    --similarity_mode $similarity_mode \
    --ltr_path $ltr_path \
    --intelligibility_mode $intelligibility_mode \
    --language $language

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API