Skip to content

akashAD98/yolov7_custom_data_trainig

Repository files navigation

yolov7 architecture

image

clone repo

1. git clone https://github.com/WongKinYiu/yolov7.git

  1. cd yolov7/

  2. !pip install requirements.txt

  3. script for dividing data into train,test & validation python yolov_train_test_split.py

create customdata folder inside yolov7 data set download link :customdata

image

-inside images paste all train & valid images

-inside labels all labels of train & valid image

. go insiode data folder & create custom_data.yaml & add path of image & labels (i.e .txt)

# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
train: ./customdata/train.txt  
val: ./customdata/valid.txt  




# number of classes
nc: 3

# class names
names: ['pistol','rifle','revolver']

for creating train.txt & val.txt use (it contains the path of images )

!python genrate_test.py

image

  1. go inside cfg/training & select any .yaml file do changes such as no classes

image

  1. start training using

!python train.py --workers 8 --device 0 --batch-size 16 --data data/custom_data.yaml --img 640 640 --cfg cfg/training/yolov7_custom_3.yaml --weights '' --name yolov7xcustom3 --hyp data/hyp.scratch.p5.yaml --epochs 200

  1. inference on video/image python yolov7_inference.py # add alll file path inside this file

python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source inference/images/horses.jpg

Releases

No releases published

Packages

No packages published