Skip to content

Biodiversity-CatTracker2/BirdFSD-YOLOv5

 
 

Repository files navigation

BirdFSD-YOLOv5

Build and train a custom model to identify birds visiting bird feeders.

📖 Documentation

Poetry Build Docker Build Documentation Status Supported Python versions PEP8 Codacy Badge GitHub latest release Docker Hub GitHub License

Requirements

🚀 Getting started

  • Then, click on and enable all the workflows that are highlighted wuth a red square in the image below.

  • On your machine, run:
git clone https://github.com/bird-feeder/BirdFSD-YOLOv5.git
cd BirdFSD-YOLOv5

# Recommended: create a conda/pyenv environment
pip install -r requirements.txt

poetry build
pip install dist/*.whl

git clone https://github.com/ultralytics/yolov5.git

mv .env.example .env
nano .env  # or with any other editor
# See `🌱 Environment Variables` section for details about the environment variables.

🌱 Environment Variables

Name Value
TOKEN Label-Studio Access Token.
LS_HOST The URL of the label-studio app (e.g., https://label-studio.example.com) – make sure you include https:// in the URL.
DB_CONNECTION_STRING MongoDB connection string (e.g., mongodb://mongodb0.example.com:27017). See this article for details.
DB_NAME Name of the main MongoDB database (default: label_studio).
S3_ACCESS_KEY (Optional) The S3 bucket's Access Key ID.
S3_SECRET_KEY (Optional) The S3 bucket's Secret Key.
S3_REGION (Optional) The S3 bucket's region (default: us-east-1).
S3_ENDPOINT (Optional) The S3 bucket's endpoint/URL server.
EXCLUDE_LABELS (Optional) Comma-separated list of labels to exclude from processing (e.g., label a,label b).

🗃️ Setup

  • To use the GitHub Actions workflows (recommended!), you will need to add every environment variable and its value from .env to the Secrets of your fork (you can find Secrets under Settings).

Click here to show an example of a new secret

🔧 Dataset preparation

  • Option 1: Run the JSON to YOLOv5 (data preprocessing) workflow under github Actions.

  • Option 2: Run it locally with:

    python birdfsd_yolov5/preprocessing/json2yolov5.py
    mv dataset-YOLO/dataset_config.yml .
    python birdfsd_yolov5/model_utils/relative_to_abs.py

⚡ Training1

Use the Colab notebook:

Open In Colab

📝 Prediction

  • Option 1: Run the Predict workflow under github Actions.

  • Option 2: Use the Colab notebook:

    Open In Colab

🐳 Using Docker

docker pull alyetama/birdfsd-yolov5:latest

Example Usage

docker run -it --env-file .env alyetama/birdfsd-yolov5 python birdfsd_yolov5/preprocessing/json2yolov5.py

🔖 Related

Footnotes

  1. yolov5/wiki/Train-Custom-Data

About

Build and train a custom model to identify birds visiting bird feeders

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 90.0%
  • Jupyter Notebook 7.8%
  • Shell 2.1%
  • Dockerfile 0.1%