Your Name commited on
Commit
37989dd
·
1 Parent(s): 35379ab

update text

Browse files
Files changed (2) hide show
  1. __pycache__/app.cpython-310.pyc +0 -0
  2. app.py +49 -11
__pycache__/app.cpython-310.pyc CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
 
app.py CHANGED
@@ -152,16 +152,54 @@ def predict(audio, start, end, model_name="BirdAST_Seq"):
152
 
153
 
154
  DESCRIPTION = """
 
 
 
 
 
 
 
 
 
 
 
155
  # Introduction
156
 
157
- It is esimated that 50% of the global economy is threatened by biodiversity loss [2]. As such, intensive efforts have been concerted into estimating bird biodiversity, as birds are a top indicator of biodiversity in the region. One of these efforts is
158
- finding the bird species in a region using bird species audio classification.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
 
160
- # Solution
161
 
162
- To tackle this problem, we propose VOJ. It first preprocesses an audio signal using a bandpass filter (1K - 8K) and then applies downsampling to 16K Hz. Afterwards, we input the signal into AudioMAE (Audio Masked AutoEncoder by Meta [1]) which extracts relevant features even in the presence of corruptions to the signal spectrogram.
163
- The AudioMAE is also trained on 527 types of audio that comprise bird, silence, environmental noise, and other types. The purpose of this initial inference stage is to provide an initial sense of the audio. If the AudioMAE outputs silence, we can expect low species prediction confidence, or if the output is insect, it may not be worth labelling.
164
- Next, we train BirdAST, which has Audio Spectrogram Transformer (AST) as backbone, followed by an attention pooling and dense layer. We also train EfficientB0 on the melspectrogram, and finally, we train a model using Wav2Vec pretrained on 50 bird species [3].
165
  """
166
 
167
 
@@ -255,11 +293,11 @@ function createGradioAnimation() {
255
  """
256
 
257
  REFERENCES = """
258
- References
259
 
260
- [1] Huang, P.-Y., Xu, H., Li, J., Baevski, A., Auli, M., Galuba, W., Metze, F., & Feichtenhofer, C. (2022). Masked Autoencoders that Listen. In NeurIPS.
261
 
262
- [2] Torkington, S. (2023, February 7). 50% of the global economy is under threat from biodiversity loss. World Economic Forum. Retrieved from https://www.weforum.org/agenda/2023/02/biodiversity-nature-loss-cop15/.
263
 
264
  [3] https://www.kaggle.com/code/dima806/bird-species-by-sound-detection
265
  """
@@ -286,7 +324,7 @@ def handle_model_selection(model_name, download_status):
286
  break
287
 
288
  if download_flag:
289
- download_status = f"Model {model_name} is ready for prediction!"
290
  else:
291
  download_status = f"An error occurred while downloading model weights."
292
 
@@ -303,7 +341,7 @@ with gr.Blocks(theme = seafoam, css = css, js = js) as demo:
303
  gr.Markdown(DESCRIPTION)
304
 
305
  # add dropdown for model selection
306
- model_names = ['BirdAST', 'BirdAST_Seq', 'EfficientNet']
307
  model_dropdown = gr.Dropdown(label="Choose a model", choices=model_names)
308
  download_status = gr.Textbox(label="Model Status", lines=3, value='', interactive=False) # Non-interactive textbox for status
309
 
 
152
 
153
 
154
  DESCRIPTION = """
155
+
156
+ <div align="center">
157
+ <b>Team Members: </b>
158
+
159
+ Amro Abdrabo [amro.abdrabo@gmail.com | [LinkedIn](https://www.linkedin.com/in/amroabdrabo/)]
160
+
161
+ Shiyi Li [shiyi.li@ifu.baug.ethz.ch | [LinkedIn](www.linkedin.com/in/shiyili01)]
162
+
163
+ Thomas Radinger [ thomasrad@protonmail.com | [LinkedIn](https://www.linkedin.com/in/thomas-radinger-743958142/) ]
164
+ </div>
165
+
166
  # Introduction
167
 
168
+ Birds are key indicators of ecosystem health and play pivotal roles in maintaining biodiversity [1]. To monitor and protect bird species, automatic bird sound recognition systems are essential. These systems can help in identifying bird species, monitoring their populations, and understanding their behavior. However, building such systems is challenging due to the diversity of bird sounds, complex acoustic interference and limited labeled data.
169
+
170
+ To tackle these challenges, we expored the potential of deep learning models for bird sound recognition. In our work, we developed two Audio Spectrogram Transformer (AST) based models: BirdAST and BirdAST_Seq, to predict bird species from audio recordings. We evaluated the models on a dataset of 728 bird species and achieved promising results. As the field-recordings may contain various types of audio rather than only bird songs/calls, we also employed an Audio Masked AutoEncoder (AudioMAE) model to pre-classify audio clips into bird, insects, rain, environmental noise, and other types. Details of the models and evaluation results are provided in the table below.
171
+
172
+ Our contributions have shown the potential of deep learning models for bird sound recognition. We hope that our work can contribute to the development of automatic bird sound recognition systems and help in monitoring and protecting bird species.
173
+
174
+
175
+ <div align="center">
176
+
177
+ | Model name | Architecture | ROC-AUC Score |
178
+ | --------------- |:------------------------------:|:-------------:|
179
+ | BirdAST | AST* + MLP | 0.6825 |
180
+ | BirdAST_Seq | AST* + Sequence Pooling + MLP | 0.7335 |
181
+
182
+ </div>
183
+
184
+ # How to use the space:
185
+
186
+ 1. Choose a model from the dropdown list. It will download the model weights automatically if not already downloaded (~30 seconds).
187
+ 2. Upload an audio clip and specify the start and end time for prediction.
188
+ 3. Click on the "Predict" button to get the predictions.
189
+ 4. In the output, you will get the audio type classification (e.g., bird, insects, rain, etc.) in the panel "Class Prediction" and the predicted bird species in the panel "Species Prediction".
190
+ - The audio types are predicted as multi-lable classification based on the AudioMAE model [2]. The predicted classes indicate the possible presence of different types of audio in the recording.
191
+ - The bird species are predicted as a multi-class classification using the selected model. The predicted classes indicate the most possible bird species present in the recording.
192
+ 5. The waveform and spectrogram of the audio clip are displayed in the respective panels.
193
+
194
+ Notes:
195
+ - For an unknown bird species, the model may predict the most similar bird species based on the training data.
196
+ - If an audio clip contains non-bird sounds (predicted by the AudioMAE), the bird species prediction may not be accurate.
197
 
198
+ **Disclaimer**: The model predictions are based on the training data and may not be accurate for all audio clips. The model is trained on a dataset of 728 bird species and may not generalize well to all bird species.
199
 
200
+ <div align="center">
201
+ <b>Enjoy the Bird Songs! 🐦🎶
202
+ </div>
203
  """
204
 
205
 
 
293
  """
294
 
295
  REFERENCES = """
296
+ # References
297
 
298
+ [1] Torkington, S. (2023, February 7). 50% of the global economy is under threat from biodiversity loss. World Economic Forum. Retrieved from https://www.weforum.org/agenda/2023/02/biodiversity-nature-loss-cop15/.
299
 
300
+ [2] Huang, P.-Y., Xu, H., Li, J., Baevski, A., Auli, M., Galuba, W., Metze, F., & Feichtenhofer, C. (2022). Masked Autoencoders that Listen. In NeurIPS.
301
 
302
  [3] https://www.kaggle.com/code/dima806/bird-species-by-sound-detection
303
  """
 
324
  break
325
 
326
  if download_flag:
327
+ download_status = f"Model <{model_name}> is ready for prediction!"
328
  else:
329
  download_status = f"An error occurred while downloading model weights."
330
 
 
341
  gr.Markdown(DESCRIPTION)
342
 
343
  # add dropdown for model selection
344
+ model_names = ['BirdAST', 'BirdAST_Seq'] #, 'EfficientNet']
345
  model_dropdown = gr.Dropdown(label="Choose a model", choices=model_names)
346
  download_status = gr.Textbox(label="Model Status", lines=3, value='', interactive=False) # Non-interactive textbox for status
347