Skip to content

Commit 4e4f7b5

Browse files
authored
Just Read It and You Will Understand How to use it
1 parent 29f00b8 commit 4e4f7b5

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Safety_Helmet_Detection_using_YOLOv5
22

3-
Create a Dataset of images(png/jpg) and labels(jpg) to it in YOLOv5 Format
3+
1)Create a Clove of This Repository
44

5+
2)Create a Dataset Folder of images(png/jpg) and labels(jpg) to it in YOLOv5 Format
56

67
YOLOv5 Format is shown Below
78

@@ -11,7 +12,7 @@ The Folder Structure of Dataser Folder Should be like
1112

1213
![alt text](https://user-images.githubusercontent.com/47482315/131216714-6c11e325-808f-4917-9d65-7f267ec78ebe.png)
1314

14-
After Placing the Images and Labels in the Dataset Folder
15+
3)After Placing the Images and Labels in the Dataset Folder
1516

1617
Edit the Config.Yaml file in our Repository
1718

@@ -23,28 +24,32 @@ As in above image we can see the File contains 4 parameters to be changed
2324
3)Number of Classes:This Determines how many types of classes or objects we want to identify using YOLOv5
2425
4)Names of Classes:This Contains names of all classes
2526

26-
After Doing this We need to install all the Required Modules used by YOLOv5 for its proper working using pip
27+
4)After Doing this We need to install all the Required Modules used by YOLOv5 for its proper working using pip
2728
The Command to be used in CLI to install all Modelues while being in our Project Directory will be: pip install -r requirements.txt
2829

29-
Now For Training The Model with your dataset just use this command:
30+
5)Now For Training The Model with your dataset just use this command:
3031
python train.py --img 416 --batch 8 --epochs 100 --data config.yaml --cfg models/yolov5s.yaml --name run_name
3132

3233
In the above image the img value 416 Depends on the dimensions of the images you are using to train and validate and name can be anything you like and all other
3334
parameters can also be changed.
3435

35-
After having a successful run of the above command we will have a new Folder named runs in which there will be a folder named same as the run_name you gave above in the command
36+
6)After having a successful run of the above command we will have a new Folder named runs in which there will be a folder named same as the run_name you gave above in the command
3637
Go in that folder and then go in Weights folder and copy the best.pt file in our main Project Directory
3738

3839
This File will be used to Detect the Hats(Objects)
3940

40-
Now using that Weights File we will run this Command
41+
7)Now using that Weights File we will run this Command
4142
python detect.py --source "Path of the images in which you want to detect the Objects" --weights best.pt
4243

43-
After Running this Command The Output images will be again in the runs Folder
44+
8)After Running this Command The Output images will be again in the runs Folder
4445

4546
The Diference Between Before Detection and After Can be seen below:
4647

4748

4849
![alt text](https://user-images.githubusercontent.com/47482315/131216590-bc881704-c599-4295-b60a-191fa65af33b.png)
4950
![alt text](https://user-images.githubusercontent.com/47482315/131216617-065dd4d6-db68-4fec-8d7a-c0a2c2ce9c44.png)
5051

52+
53+
This Project is based on YOLOv5 by https://github.com/ultralytics/yolov5
54+
Huge Thanks to Them For making it so easy...
55+

0 commit comments

Comments
 (0)