diff --git a/README.md b/README.md index 8a03252..6363860 100644 --- a/README.md +++ b/README.md @@ -32,18 +32,14 @@ The `generate` command accepts one input file or one input folder and one output #### Usage ``` -generate [-F|--format] [-c|--config ] +generate The file to generate embeddings for The directory to write the embeddings to -F|--format [csv|parquet] The format of the embeddings file: `CSV`` or `Parquet`` -c|--config An optional configuration file to use ``` -#### Configuration file -```yaml -hop_length_seconds: 5.0 -``` #### Examples @@ -75,60 +71,9 @@ classify [-F|--format] [-c|--config ] ] - The file to generate embeddings for - The directory to write the embeddings to - The file to use as the query - -c|--config An optional configuration file to use -``` - -#### Configuration file - -```yaml -hop_length_seconds: 5.0 +classifier: keras_saved_model_path ``` -#### Example - -```bash -cd /data -curl -o audio.wav https://api.ecosounds.org/audio_recordings/123.wav -curl -o query.wav https://api.ecosounds.org/audio_recordings/456/media.wav?start=10&end=15 -docker run -v /data:/data perch-runner distance -c /data/config.yml /data/audio.wav /data/query.wav /data/output -``` ## Batch Mode diff --git a/models/mgw/mgw_v05.keras b/models/mgw/mgw_v05.keras new file mode 100755 index 0000000..67bc572 Binary files /dev/null and b/models/mgw/mgw_v05.keras differ diff --git a/models/mgw/mgw_v05.keras.labels.json b/models/mgw/mgw_v05.keras.labels.json new file mode 100755 index 0000000..631fec7 --- /dev/null +++ b/models/mgw/mgw_v05.keras.labels.json @@ -0,0 +1 @@ +["mgw", "negative"] \ No newline at end of file diff --git a/scripts/Readme.md b/scripts/Readme.md index 4d13b41..eac8bb0 100644 --- a/scripts/Readme.md +++ b/scripts/Readme.md @@ -25,8 +25,11 @@ Notes 1. Open a terminal window 2. Change directory to this scripts directory 3. Run the following command: - - windows: `powershell -ExecutionPolicy Bypass -File analyze.ps1 classify [path_to_audio_folder] [path_to_embeddings_folder] 'pw'` - - linux or intel mac: `./analyze.sh classify [path_to_embeddings_output_folder] [path_to_classifications_output_folder] 'pw'` + - windows: `powershell -ExecutionPolicy Bypass -File analyze.ps1 classify [path_to_audio_folder] [path_to_embeddings_folder] '[recognizer_id]'` + - linux or intel mac: `./analyze.sh classify [path_to_embeddings_output_folder] [path_to_classifications_output_folder] '[recognizer_id]'` + - where [recognizer_id] is one of + - 'pw' (Plains wanderer) + - 'mgw' (Mukarrthippi graw wren) Notes diff --git a/scripts/analyze.ps1 b/scripts/analyze.ps1 index dcac679..9ac0dce 100644 --- a/scripts/analyze.ps1 +++ b/scripts/analyze.ps1 @@ -39,10 +39,11 @@ $config = "" $recognizer_configs = @{ "pw" = "pw.classify.yml" "cgw" = "cgw.classify.yml" + "mgw" = "mgw.classify.yml" } # Check if the recognizer argument has been provided -if ($recognizer) { +if ($recognizer -and $analysis -eq "classify") { # Check if the provided recognizer is supported and set the config variable if ($recognizer_configs.ContainsKey($recognizer)) { $config = $recognizer_configs[$recognizer] diff --git a/scripts/analyze.sh b/scripts/analyze.sh index 58ff5dd..728e399 100755 --- a/scripts/analyze.sh +++ b/scripts/analyze.sh @@ -35,27 +35,33 @@ fi # Initialize command with a default value command="" -declare -A recognizer_configs -recognizer_configs["pw"]="pw.classify.yml" -recognizer_configs["cgw"]="cgw.classify.yml" - -# Check if the recognizer argument has been provided -if [[ -n "$recognizer" ]]; then - # Check if the provided recognizer is supported and set the config variable - if [[ -n ${recognizer_configs[$recognizer]} ]]; then - config=${recognizer_configs[$recognizer]} - echo "Using config file: $config" - config="--config $config" +# if analysis is 'classify' +if [[ "$analysis" == "classify" ]]; then + declare -A recognizer_configs + recognizer_configs["pw"]="pw.classify.yml" + recognizer_configs["cgw"]="cgw.classify.yml" + recognizer_configs["mgw"]="mgw.classify.yml" + + # Check if the recognizer argument has been provided + if [[ -n "$recognizer" ]]; then + # Check if the provided recognizer is supported and set the config variable + if [[ -n ${recognizer_configs[$recognizer]} ]]; then + config=${recognizer_configs[$recognizer]} + echo "Using config file: $config" + config="--config $config" + else + echo "Recognizer $recognizer not supported" + exit 1 + fi else - echo "Recognizer $recognizer not supported" - exit 1 + # Set config variable to an empty string if no recognizer is provided + config="" fi -else - # Set config variable to an empty string if no recognizer is provided - config="" fi + + # paths to things inside the container, to be mounted # Determine input container path diff --git a/src/default_configs/mgw.classify.yml b/src/default_configs/mgw.classify.yml new file mode 100644 index 0000000..39ecfc4 --- /dev/null +++ b/src/default_configs/mgw.classify.yml @@ -0,0 +1,2 @@ +classifier: mgw +inherit: classify.yml diff --git a/tests/docker_tests/test_analyze.py b/tests/docker_tests/test_analyze.py index 66a9202..61a1921 100644 --- a/tests/docker_tests/test_analyze.py +++ b/tests/docker_tests/test_analyze.py @@ -7,7 +7,8 @@ ["pwsh", "-ExecutionPolicy", "Bypass", "-File", "./scripts/analyze.ps1"] ] -index = 1 +index = 0 +#image = "pr10:latest" def test_analyze_script_classify(): @@ -19,7 +20,7 @@ def test_analyze_script_classify(): shutil.copy("tests/files/embeddings/100sec.parquet", two) # Run the embed helper script - command = scripts[index] + ["classify", "./tests/input/", "./tests/output/", "pw"] + command = scripts[index] + ["classify", "./tests/input/", "./tests/output/", "mgw"] print(f'running command: {" ".join(command)}') subprocess.run(command, check=True)