Данный репозиторий содержит проект по компьютерному зрению, который считает количество тихоокеанских чаек на острове Ушатуд, входящем в Южно-Камчатский федеральный заповедник. Модель построена с использованием YOLOv8 и обучена на изображениях с фотоловушки, чтобы помочь инспекторам заповедника в их природоохранной деятельности.
Мне было интересно поработать с современными моделями компьютерного зрения, в частности YOLOv8, применить различные Data Augmentations к изображениями, освоить ClearML для отслеживания моделей, экспериментов и метрик, а также получить опыт создания полноценного ML проекта, а не просто Jupyter Notebook.
- Python 3.11+
- NumPy
- Pandas
- OpenCV (cv2)
- TQDM
- Ultralytics YOLOv8
- PyTorch
- DataAugmentationForObjectDetection
- Requests
seagull-detection-project/
├── data/
├── models/
├── notebooks/
│ └──Seagull_Count.ipynb
├── output/
├── scripts/
│ ├── prepare_data.py
│ ├── train.py
│ ├── predict.py
│ └── evaluate.py
├── src/
│ ├── __init__.py
│ ├── augmentations.py
│ ├── data_aug/
│ │ ├──__init__.py
│ │ ├──bbox_util.py
│ │ └──data_aug.py
│ ├── data_utils.py
│ └── processing.py
├── .gitignore
├── README.md
└── requirements.txt
Для настройки среды проекта выполните следующее:
-
Клонируйте репозиторий:
git clone https://github.com/mikhailvokhrameev/seagull_recognition_hackaton.git cd seagull_recognition_hackaton -
Создайте и активируйте виртуальное окружение (рекомендуется):
# Создание окружения python3 -m venv venv # Активация на macOS/Linux: source venv/bin/activate # Активация на Windows: # venv\Scripts\activate
-
Установите:
pip install -r requirements.txt
Важно: Все команды должны запускаться из корневой папки проекта.
Этот скрипт загружает датасет, распаковывает его и создает конфигурационный файл data.yaml, необходимый для обучения.
python -m scripts.prepare_dataЭтот скрипт обучает модель YOLOv8. При первом запуске следует использовать флаг --preprocess, чтобы применить все этапы обработки и дополнения данных.
# Для обучения с предобработкой на GPU (рекомендуется)
python -m scripts.train --preprocess --epochs 200 --batch 16 --device 0
# Для обучения на CPU (будет очень медленно)
python -m scripts.train --preprocess --epochs 200 --batch 16 --device cpu- Лучшие веса модели будут сохранены в новой папке
runs/detect/train/. Для удобства скопируйте файлbest.ptиз этого каталога в каталогmodels/перед запуском predict.
Используйте этот скрипт для проверки среднеквадратичной ошибки (RMSE) подсчетов вашей модели по сравнению с истинными labels в валидационной выборке.
python -m scripts.evaluate --weights models/best.pt --source valid/images/Используйте этот скрипт для создания CSV-файла с данными о количестве чаек для новой папки с изображениями.
# Пример для тестового набора, расположенного в папке с именем «test_images»
python -m scripts.predict --weights models/best.pt --source test_images/ --output output/submission.csvИтоговый файл submission.csv будет сохранен в папке output/.
Проект использует сторонний код для аугментации изображений:
- DataAugmentationForObjectDetection
- Ссылка на репозиторий: https://github.com/Paperspace/DataAugmentationForObjectDetection
- Лицензия: MIT
- В проекте используется модуль
data_augдля аугментаций изображений и bounding boxes.
This repository contains a computer vision project to count the number of slaty-backed gulls on Utashud Island, part of the South Kamchatka Federal Reserve. The model is built using YOLOv8 and trained on images from a camera trap to aid reserve inspectors in their conservation efforts.
I was interested in working with modern computer vision models, specifically YOLOv8, applying various Data Augmentations to images, mastering ClearML for tracking models, experiments, and metrics, and gaining experience in creating a full-fledged ML project, rather than just a *Jupyter Notebook *.
- Python 3.11+
- NumPy
- Pandas
- OpenCV (cv2)
- TQDM
- Ultralytics YOLOv8
- PyTorch
- DataAugmentationForObjectDetection
- Requests
seagull-detection-project/
├── data/
├── models/
├── notebooks/
│ └──Seagull_Count.ipynb
├── output/
├── scripts/
│ ├── prepare_data.py
│ ├── train.py
│ ├── predict.py
│ └── evaluate.py
├── src/
│ ├── __init__.py
│ ├── augmentations.py
│ ├── data_aug/
│ │ ├──__init__.py
│ │ ├──bbox_util.py
│ │ └──data_aug.py
│ ├── data_utils.py
│ └── processing.py
├── .gitignore
├── README.md
└── requirements.txt
Follow these steps to set up the project environment.
-
Clone the Repository:
```bash git clone https://github.com/mikhailvokhrameev/seagull_recognition_hackaton.git cd seagull_recognition_hackaton
-
Create and Activate a Virtual Environment (Recommended): This isolates the project's dependencies from your system's Python installation.
# Create the environment python3 -m venv venv # Activate it (on macOS/Linux) source venv/bin/activate # On Windows, use: # venv\Scripts\activate
-
Установите необходимые пакеты:
pip install -r requirements.txt
Important: All commands should be run from the root directory of the project.
This script downloads the seagull dataset, unzips it, and creates the data.yaml configuration file required for training.
python -m scripts.prepare_dataThis script trains the YOLOv8 model. The --preprocess flag should be used for the first run to apply all data processing and augmentation steps.
# To train with preprocessing on a GPU (recommended)
python -m scripts.train --preprocess --epochs 200 --batch 16 --device 0
# To train on a CPU (will be very slow)
python -m scripts.train --preprocess --epochs 200 --batch 16 --device cpu- The best model weights will be saved in a new
runs/detect/train/directory. For convenience, copy thebest.ptfile from there into themodels/directory before running predictions.
Use this script to check the Root Mean Squared Error (RMSE) of your model's counts against the ground truth labels in the validation set.
python -m scripts.evaluate --weights models/best.pt --source valid/images/Use this script to generate a submission CSV file with seagull counts for a new directory of images.
# Example for a test set located in a folder named 'test_images'
python -m scripts.predict --weights models/best.pt --source test_images/ --output output/submission.csvThe final submission.csv will be saved in the output/ folder.
The project uses third-party code for image augmentation:
- DataAugmentationForObjectDetection
- Repository link: https://github.com/Paperspace/DataAugmentationForObjectDetection
- License: MIT
- The project uses the
data_augmodule for image and bounding box augmentation.



