Skip to content

Commit

Permalink
Update A_VIRER__TEST_full_process_test.py, birdnet_test.py, and 16 mo…
Browse files Browse the repository at this point in the history
…re files...
  • Loading branch information
shaupert committed Nov 30, 2022
1 parent c289b6e commit 2446574
Show file tree
Hide file tree
Showing 18 changed files with 327 additions and 267 deletions.
169 changes: 0 additions & 169 deletions article/A_VIRER__TEST_full_process_test.py

This file was deleted.

9 changes: 1 addition & 8 deletions article/birdnet_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# Clear all the variables
get_ipython().magic('reset -sf')

import yaml
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
Expand All @@ -28,15 +27,9 @@
DIR_DATA = Path('./data/test')
ANNOT_CSV_FILE = 'manual_annotations.csv'
BIRDNET_CSV_FILE= "birdnet_annotations.csv"
CONFIG_FILE = 'config_article.yaml'

# %%
if __name__ == '__main__':

with open(CONFIG_FILE) as f:
params = yaml.load(f, Loader=bambird.get_loader())

# %%
if __name__ == '__main__':

# BirdNET on ROIS
# ---------------------------------------------------------------------
Expand Down
10 changes: 2 additions & 8 deletions article/birdnet_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
# Clear all the variables
get_ipython().magic('reset -sf')

import yaml
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
plt.close("all")


import bambird

# %%
Expand All @@ -28,16 +28,10 @@
DIR_DATA = Path('./data/train')
ANNOT_CSV_FILE = 'manual_annotations.csv'
BIRDNET_CSV_FILE= "birdnet_annotations.csv"
CONFIG_FILE = 'config_article.yaml'

# %%
if __name__ == '__main__':

with open(CONFIG_FILE) as f:
params = yaml.load(f, Loader=bambird.get_loader())

# %%


# BirdNET on ROIS
# ---------------------------------------------------------------------
# Load the dataframe with the result from BirdNET
Expand Down
8 changes: 1 addition & 7 deletions article/birdnet_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,10 @@
DIR_DATA = Path('./data/validation')
ANNOT_CSV_FILE = 'manual_annotations.csv'
BIRDNET_CSV_FILE= "birdnet_annotations.csv"
CONFIG_FILE = 'config_article.yaml'

# %%
if __name__ == '__main__':

with open(CONFIG_FILE) as f:
params = yaml.load(f, Loader=bambird.get_loader())

# %%


# BirdNET on ROIS
# ---------------------------------------------------------------------
# Load the dataframe with the result from BirdNET
Expand Down
8 changes: 4 additions & 4 deletions article/clustering_only_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# Clear all the variables
get_ipython().magic('reset -sf')

import yaml
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
plt.close("all")

import bambird
import bambird.config as cfg

# %%
# Define constants
# ----------------
Expand All @@ -32,8 +32,8 @@
# %%
if __name__ == '__main__':

with open(CONFIG_FILE) as f:
params = yaml.load(f, Loader=bambird.get_loader())
# Load the configuration file
params = cfg.load_config(CONFIG_FILE)

# Name of the csv file with feaetures
FEATURES_CSV_FILE = (
Expand Down
10 changes: 4 additions & 6 deletions article/clustering_only_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
import matplotlib.pyplot as plt
plt.close("all")

bambird_path = Path('/home/haupert/DATA/mes_projets/Z_THESE_FELIX_MICHAUD/CHAPITRE_1/bambird.git')
import os
os.sys.path.append(bambird_path.as_posix())
import bambird
import bambird.config as cfg

# %%
# Define constants
Expand All @@ -34,9 +32,9 @@

# %%
if __name__ == '__main__':

with open(CONFIG_FILE) as f:
params = yaml.load(f, Loader=bambird.get_loader())
# Load the configuration file
params = cfg.load_config(CONFIG_FILE)

# Name of the csv file with feaetures
FEATURES_CSV_FILE = (
Expand Down
6 changes: 4 additions & 2 deletions article/clustering_only_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
plt.close("all")

import bambird
import bambird.config as cfg

# %%
# Define constants
# ----------------
Expand All @@ -31,8 +33,8 @@
# %%
if __name__ == '__main__':

with open(CONFIG_FILE) as f:
params = yaml.load(f, Loader=bambird.get_loader())
# Load the configuration file
params = cfg.load_config(CONFIG_FILE)

# Name of the csv file with feaetures
FEATURES_CSV_FILE = (
Expand Down
4 changes: 2 additions & 2 deletions article/config_article.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ PARAMS_XC:
- len:30-60
- q:">C"
- type:song
#CSV_XC_FILE: 'dataset_xc_embcit.csv' # The file will contain all the metadata collected from Xeno-canto
CSV_XC_FILE: 'bam_dataset_xc.csv' # The file will contain all the metadata collected from Xeno-canto

################################
# ROIS EXTRACTION PARAMETERS
################################
PARAMS_EXTRACT:
# function
FUNC: !fun bambird.extract_rois_core # select the function used to extract the rois {bambird.extract_rois_core, bambird.extract_rois_full_sig}
FUNC: !FUNC bambird.extract_rois_core # select the function used to extract the rois {bambird.extract_rois_core, bambird.extract_rois_full_sig}
# Extract Audio resampling
SAMPLE_RATE: 44100 # Sampling frequency in Hz
# Audio preprocess
Expand Down
9 changes: 4 additions & 5 deletions article/full_process_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# Clear all the variables
get_ipython().magic('reset -sf')

import yaml
from pathlib import Path
import matplotlib.pyplot as plt
plt.close("all")
import pandas as pd

import bambird
import bambird.config as cfg

# %%
# Define constants
Expand All @@ -42,8 +42,8 @@
# %%
if __name__ == '__main__':

with open(CONFIG_FILE) as f:
params = yaml.load(f, Loader=bambird.get_loader())
# Load the configuration file
params = cfg.load_config(CONFIG_FILE)

# load the inital dataset with the metadata stored from XC
df_dataset = pd.read_csv(XC_CSV_FILE, sep=';')
Expand All @@ -69,7 +69,6 @@
# extract ROIS
df_rois, csv_rois = bambird.multicpu_extract_rois(
dataset =df_xc,
fun =params['PARAMS_EXTRACT']['FUNC'],
params =params['PARAMS_EXTRACT'],
save_path =DIR_DATA / ROIS_NAME,
overwrite =True,
Expand Down Expand Up @@ -98,7 +97,7 @@
df_cluster, csv_cluster = bambird.find_cluster(
dataset =df_features,
params =params['PARAMS_CLUSTER'],
save_path =DIR_DATA / ROIS_NAME,
save_path =DIR_DATA / ROIS_NAME,
display =False,
verbose =True
)
Expand Down
Loading

0 comments on commit 2446574

Please sign in to comment.