From 6c7b04c177a8c057ed5e05ed22a60ac905c19dea Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 23 Apr 2021 09:51:46 -0700 Subject: [PATCH] Removed plot_bird_label_scores() from statistics.py - Forgot to remove it when I migrated all of the matplotlib related functions into visualizations.py --- IsoAutio/statistics.py | 82 ------------------------------------------ 1 file changed, 82 deletions(-) diff --git a/IsoAutio/statistics.py b/IsoAutio/statistics.py index 73dab5d..e71c4af 100644 --- a/IsoAutio/statistics.py +++ b/IsoAutio/statistics.py @@ -109,88 +109,6 @@ def bird_label_scores(automated_df,human_df): return pd.DataFrame(entry,index=[0]) -def plot_bird_Label_scores(automated_df,human_df,save_fig = False): - """ - Function to visualize automated and human annotation scores across an audio clip. - - Args: - automated_df (Dataframe) - Dataframe of automated labels for one clip - human_df (Dataframe) - Dataframe of human labels for one clip. - plot_fig (boolean) - Whether or not the efficiency statistics should be displayed. - save_fig (boolean) - Whether or not the plot should be saved within a file. - - Returns: - Dataframe with statistics comparing the automated and human labeling. - """ - duration = automated_df["CLIP LENGTH"].to_list()[0] - SAMPLE_RATE = automated_df["SAMPLE RATE"].to_list()[0] - # Initializing two arrays that will represent the human labels and automated labels with respect to - # the audio clip - #print(SIGNAL.shape) - human_arr = np.zeros((int(SAMPLE_RATE*duration),)) - bot_arr = np.zeros((int(SAMPLE_RATE*duration),)) - - folder_name = automated_df["FOLDER"].to_list()[0] - clip_name = automated_df["IN FILE"].to_list()[0] - # Placing 1s wherever the au - for row in automated_df.index: - minval = int(round(automated_df["OFFSET"][row]*SAMPLE_RATE,0)) - maxval = int(round((automated_df["OFFSET"][row] + automated_df["DURATION"][row]) *SAMPLE_RATE,0)) - bot_arr[minval:maxval] = 1 - for row in human_df.index: - minval = int(round(human_df["OFFSET"][row]*SAMPLE_RATE,0)) - maxval = int(round((human_df["OFFSET"][row] + human_df["DURATION"][row])*SAMPLE_RATE,0)) - human_arr[minval:maxval] = 1 - - human_arr_flipped = 1 - human_arr - bot_arr_flipped = 1 - bot_arr - - true_positive_arr = human_arr*bot_arr - false_negative_arr = human_arr * bot_arr_flipped - false_positive_arr = human_arr_flipped * bot_arr - true_negative_arr = human_arr_flipped * bot_arr_flipped - IoU_arr = human_arr + bot_arr - IoU_arr[IoU_arr == 2] = 1 - - plt.figure(figsize=(22,10)) - plt.subplot(7,1,1) - plt.plot(human_arr) - plt.title("Ground Truth for " + clip_name) - plt.subplot(7,1,2) - plt.plot(bot_arr) - plt.title("Automated Label for " + clip_name) - - #Visualizing True Positives for the Automated Labeling - plt.subplot(7,1,3) - plt.plot(true_positive_arr) - plt.title("True Positive for " + clip_name) - - #Visualizing False Negatives for the Automated Labeling - plt.subplot(7,1,4) - plt.plot(false_negative_arr) - plt.title("False Negative for " + clip_name) - - plt.subplot(7,1,5) - plt.plot(false_positive_arr) - plt.title("False Positive for " + clip_name) - - plt.subplot(7,1,6) - plt.plot(true_negative_arr) - plt.title("True Negative for " + clip_name) - - plt.subplot(7,1,7) - plt.plot(IoU_arr) - plt.title("Union for " + clip_name) - - plt.tight_layout() - if save_fig == True: - x = clip_name.split(".") - clip_name = x[0] - plt.save_fig(clip_name + "_label_plot.png") - - - - # Will have to adjust the isolate function so that it adds a sampling rate onto the dataframes. def automated_labeling_statistics(automated_df,manual_df):