Awesome
<h1 align="center"> TO BE UPDATED SOON! </h1>The current codebase will be updated soon to reflect the results found in the following paper:
Deep object detection for waterbird monitoring using aerial imagery<br/> Krish Kabra<sup>*,1</sup>, Alexander Xiong<sup>*,1</sup>, Wenbin Li<sup>*,1</sup>, Minxuan Luo<sup>1</sup>, William Lu<sup>1</sup>, Raul Garcia<sup>1</sup>, Dhananjay Vijay<sup>1</sup>, Jiahui Yu<sup>1</sup>, Maojie Tang<sup>1</sup>, Tianjiao Yu<sup>1</sup>, Hank Arnold<sup>2</sup>, Anna Vallery<sup>2</sup>, Richard Gibbons<sup>3</sup>, Arko Barman<sup>1</sup> <br/> <sup>*</sup> equal contribution <br/> <sup>1</sup>Rice University, Houston, TX 77005, USA <br/> <sup>2</sup>Houston Audubon Society, Houston, TX 77079, USA <br/> <sup>3</sup>American Bird Conservancy, The Plains, VA 20198, USA <br/>
Stay tuned!
</br> <h1 align="center"> Team Audubon </h1> <h3 align="center"> Development of Machine Learning Algorithms for Precision Waterbird Monitoring </h3> </br> <!-- TABLE OF CONTENTS --> <h2 id="table-of-contents"> Table of Contents</h2> <details open="open"> <summary>Table of Contents</summary> <ol> <li><a href="#Team Audubon in 2022Fall"> ➤ About The Project</a></li> <li><a href="#prerequisites"> ➤ Prerequisites</a></li> <li><a href="#folder-structure"> ➤ Folder Structure</a></li> <li><a href="#installation"> ➤ Installation & Usage Instructions</a></li> <li><a href="#dataset"> ➤ Dataset</a></li> <li> <a href="#preprocessing"> ➤ Preprocessing</a> <ul> <li><a href="#tiling">Tiling</a></li> <li><a href="#data-augmentation">Data Augmentation</a></li> </ul> </li> <!--<li><a href="#experiments">Experiments</a></li>--> <li><a href="#results-and-discussion"> ➤ Results and Discussion</a></li> <li><a href="#references"> ➤ References</a></li> <li><a href="#contributors"> ➤ Contributors</a></li> </ol> </details> <br>
<img src="https://raw.githubusercontent.com/facebookresearch/detectron2/main/.github/Detectron2-Logo-Horz.svg" width="200"> <br>
The following open source packages are used in this project:
- Numpy
- Pandas
- Matplotlib
- OpenCV
- Detectron2
- WAndB
code
.
├── configs
├────── (useful sweep config files for WAndB)
├── scripts
├────── data_exploration.py
├── utils
├────── config.py
├────── cropping.py
├────── dataloader.py
├────── evaluation.py
├────── plotting.py
├────── trainer.py
├── README.md
├── requirements.txt
├── data_exploration.py
├── Audubon-Bird-Detection-Tutorial.ipynb
├── train_net.py
├── wandb_train_net.py
git clone https://github.com/RiceD2KLab/Audubon_F21.git
<li><b>Install Pytorch</b></li>
<a href="https://pytorch.org/get-started/locally/">Installation instructions here</a> <br>
Requirements: Linux or macOS with Python ≥ 3.6
pip3 install torch==1.10.0+cu102 torchvision==0.11.1+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html
<li> <b> Install Detectron2 </b> </li>
<a href="https://detectron2.readthedocs.io/en/latest/tutorials/install.html">Installation instructions here</a> <br>
Requirements: Linux or macOS with Python ≥ 3.6 <br>
For Windows: Detectron2 is continuously built on Windows with CircleCI. However, official support for it is not provided.
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
# (add --user if you don't have permission)
# Or, to install it from a local clone:
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2
# On macOS, you may need to prepend the above commands with a few environment variables:
CC=clang CXX=clang++ ARCHFLAGS="-arch x86_64" python -m pip install ...
<li>Install other dependencies</li>
pip install requirements.txt
<li>Execute the scripts as required.</li>
See train_net.py, wandb_train_net.py, or Colab Notebook for usage of code.
</ol> </p>A caveat of this approach is that unavoidably some birds will be cut into two parts and appear in two neighboring patches, as seen in Figure 2. In addition, as counting the number of birds is among the objectives, the same problem needs to be tackled in the detection phase as well. In this case, only the generated image with over 50% fraction of the cropped bird keeps the bounding box, while the remaining fraction of the bounding box in another image is discarded. This means that we are training the model to detect both complete birds and partial birds.
In the detection stage, we will also try to come up with a proper merging mechanism to merge partial detection in neighboring patches and count as one if repeated counting is a common pattern in detection.
</p>Deep learning models are effective with about 1,000 images per class, but some bird species do not have abundant training samples in our dataset. Our team plans to make deep learning models more robust via data augmentation, which means training models with synthetically modified data:
<ul> <li><b>rotation: </b>Orthogonal or non-orthogonal rotations. Rotation is a natural data augmentation step for our data at hand because the bird images are taken from different angles by drones.</li> <li><b>random crop: </b>Randomly sample a section from the image and resize it to the original image size.</li> </ul>These data augmentation steps help models adapt to different orientations, locations, and scales of the same object class, and will boost the performance of the models.
We utilized the <i>imgaug</i> library to generate modified images. We have tried several types of augmentations: flipping, blurring, adding Gaussian noise and changing color contrasts.
<b> For the time being, our model is only trained on original data. </b> We plan to retrain our model on the augmented dataset and compare performances. We are generating a larger training set using the augmentation methods mentioned above. Specifically, both the original images and the transformed images will be fed to the model in the training phase, but only original images will be used for evaluation and testing purposes.
</p>We utilize a RetinaNet and Faster R-CNN module both with a ResNet-50-FPN backbone. We first train our model to perform the simple task of detecting birds with no distinction of species. We then train the model to identify bird species: namely, Brown Pelicans, Laughing Gulls, Mixed Terns, Great Blue Herons, and Great Egrets/White Morphs.
Due to the lack of annotated data available for other bird species, we re-label all other bird species under the "Other/Unknown" category.
<i><b>Note:</b> The model weights used to initialize both the bird-only and bird-species detector come from a pre-trained model on the MS COCO dataset. </i>
<ol> <li><b>Bird-only detector (RetinaNet ResNet-50 FPN)</b></li>Birds | |
---|---|
AP (IoU = 0.5) | 93.7% |
AP (IoU = 0.75) | 26.4% |
mAP | 43.7% |
The high AP of 93.7% using an IoU threshold of 0.50 is very promising.
The mAP of 43.7% is comparableto the state-of-the-art results for challenging object detection tasks such as on the COCO dataset.
<li><b>Bird species detector (Faster R-CNN ResNet-50 FPN)</b></li>Brown Pelican | Laughing Gull | Mixed Tern | Great Blue Heron | Great Egret/White Morph | Other/Unknown | Overall | |
---|---|---|---|---|---|---|---|
AP (IoU = 0.5) | 98.8% | 100.0% | 97.6% | 98.5% | 96.9% | 0.0% | 82.0% |
The higher AP for all bird species using an IoU threshold of 0.50 in comparison to the bird-only detector is excellent, except for the “Other/Unknown” categroy, where the model drastically fails to classify. Nevertheless, we can combine the results from a bird-only detector and bird-species detector to recover the poor performance of the "Other/Unknown" bird category.
</ol> </p><b>Krish Kabra</b> <br> Email: krish.kabra@rice.edu <a></a> <br> GitHub: <a href="https://github.com/krishk97">@krishk97</a> <br>
<b>Minxuan Luo</b> <br> Email: ml122@rice.edu<a></a> <br> GitHub: <a href="https://github.com/minxuanluo">@minxuanluo</a> <br>
<b>Alexander Xiong</b> <br> Email: xionga27@rice.edu<a></a> <br> GitHub: <a href="https://github.com/awx1">@awx1</a> <br>
<b>William Lu</b> wyl1@rice.edu<br> Email: <a></a> <br> GitHub: <a href="">@</a> <br>
<b>Anna Vallery</b> <br> Email: avallery@houstonaudubon.org<a></a> <br>
<b>Richard Gibbons Lu</b> <br> Email: rgibbons@houstonaudubon.org<a></a> <br>
<b>Hank Arnold</b> <br> Email: hmarnold@msn.com<a></a> <br>
</p> <br> ✤ <i>This was the project for the course COMP 449/549 - Machine Learning and Data Science Projects (Fall 2021), at <a href="https://www.rice.edu/">Rice University</a><i>