Skip to content

Roman54228/detection_model

Repository files navigation

Detection model

Install

Clone repo and install requirements.txt in a Python>=3.7.0 environment, including PyTorch>=1.7.

git clone https://github.com/Roman54228/detection_model  # clone
cd detection_model
pip install -r requirements.txt  # install

1. Dataset

Configure root path path to your dataset in config data/config.yaml.

You need 2 folders: images and .txt annotations in yolo format: class_id center_x center_y width height

All datasets: link

Used for training: POSAD1(train+val), Test_SPB, Robo, prepared_data_all(train+val), Monitoring_photo

Used for evaluation: Test_Monitoring, Test_Monitoring2

Running train.py, eval.py will scan dataset directory and put everything into .cache file which is used for training or eval. It is able to manage images with no annotations and interpret as there's no objects.

There is possibility for more flexible dataset tuning. You can split data as you need and list all folders in config. It is important that the name of the folder with the images matches name of the folder with labels.

train: # train images (relative to 'path')  
  - images/posad1
  - images/spb
  - images/robo
val: # val images (relative to 'path')  
  - images/test_monitoring
  - images/test_monitoring2

2. Checkpoints

Model size
(pixels)
mAPval
0.5:0.95
mAPval
0.5
Speed
V100 bs1
(ms)
params
(M)
28classes_YOLOv5x 832x448 46.9 59.0 21.3 86.7
5classes_YOLOv5x 832x448 40.5 54.4 21.0 86.7
28classes_YOLOv5x6 1280x704 46.9 58.40 26.3 140.7

3. Training

Automatically logs mAP, AP_per_class and media files into wandb. Hyperparameters and augmentations written in data/hyps/hyp.scratch-low.yaml, give a flag --hyp with a path for your own hyperparameters config

python train.py --data config28.yaml --batch-size 16 --epochs 300 --img 832

All training results are saved to runs/train/ with incrementing run directories, i.e. runs/train/exp2, runs/train/exp3 etc. Use the largest --batch-size possible, or pass --batch-size -1 for YOLOv5 AutoBatch.

Modify training hyperpaameters in data/hyp - augmentations, optimizer and loss.

Example of mosaic augmentation: This is an image

4. Evalutation

python val.py --data config28.yaml --weights yolov5x.pt

All evaluation results are saved to runs/val/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages