当前位置:网站首页>Yolov5 realizes road crack detection
Yolov5 realizes road crack detection
2022-06-12 04:54:00 【sinat_ twenty-eight million three hundred and seventy-one thous】
Yolov5 Realize road crack detection
I modified the code Baidu network disk link
password :2mzl
password :06dj
be based on Pytorch Of Yolov5 Operation instructions for road crack detection program . You can use it in combination with my description and the original description , Any questions are welcome .
List of articles
Environmental requirements
Python 3.8 Or later
And install requirements.txt All dependent packages in the file , Include 1.7 And above torch
$ pip install -r requirements.txt
test
Put pictures or video files in and before running detect.py In the same directory , Then run the following statement :
$ python detect.py --source 20200827153531.mp4 # video
file.jpg # image
Because I have put the trained model into ./runs/train/exp_1000/weights/ The path is down , If you train your model , Remember to change to your own model path .
Original drawing mark :
Test mark :
Because you can't play video , So it was uploaded to Baidu cloud disk , You can take your own ( Contains the original video and results ).
https://pan.baidu.com/s/1DEu0TYcdowtt6k_A1wOxTQ
password :2mzl
Train your own dataset
1. establish dataset.yaml file
The file shall meet the following format ( Here's the picture ):
- Download address ( Don't worry about what you don't have )
- Training picture path
- Verify image path
- Number of classes
- Class name
# download command/URL (optional)
download: https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip
# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
train: ../coco128/images/train2017/
val: ../coco128/images/train2017/
# number of classes
nc: 80
# class names
names: ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard',
'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors',
'teddy bear', 'hair drier', 'toothbrush']
2. Create label file
The file shall meet the following format ( Here's the picture ):
- One picture one txt file
- One goal per line
- Every line is
class x_center y_center width heightThe format of , That is, the sequence number corresponding to the class , Target x Axis center point , Target y Axis center point , And width and height , Pay attention to no more than 1, Are pixels divided by width or height .( Normal data sets generally have their own labels in this format , If there is no such format , You need to write your own program to convert , If there are no labels, only pictures , You need to download the marking software by yourself , Then mark the picture ) - The serial number from 0 Start
0 0.9583333333333334 0.9408333333333334 0.07333333333333333 0.08833333333333333
2 0.7958333333333334 0.8391666666666667 0.4083333333333334 0.04833333333333334
0 0.4083333333333334 0.8508333333333334 0.17666666666666667 0.12166666666666667
3. Organization file path
Pay attention to the 1 Step establish dataset.yaml file File path in , Put the file in the path you fill in .
4. Choose a model
Recommended choice YOLOv5s, Small and fast .
5. Start training
If I use theta Pycharm Right click train.py file open in terminal, Enter the following code , If not Pycharm, You can do it again cmd in , Transfer to train.py Under the path , Then run the following statement to start training .(-- After that, it represents the parameter ,img Is the size of the image to be scaled , It is better to be the same size as the original drawing ,epochs Is the number of iterations ,data Is the file created in the first step ,weight That is, the trained weight )
# Train YOLOv5s on COCO128 for 5 epochs
python train.py --img 640 --batch 16 --epochs 5 --data coco128.yaml --weights yolov5s.pt
CO128 for 5 epochs
python train.py --img 640 --batch 16 --epochs 5 --data coco128.yaml --weights yolov5s.pt
If there is a problem , You can add the following QR code for consultation

边栏推荐
- Interview must ask: summary of ten classic sorting algorithms
- How to make datasets, train them into models and deploy them based on yolov5
- How to deploy PostgreSQL as a docker container
- The emergence of new ides and the crisis of programmers?
- Musk promotes the development of fascinating new products partners remind important questions
- IC验证中的force/release 学习整理(5)研究对 reg类型信号的影响
- Why is Julia so popular?
- Parallélisation de l'entraînement accéléré TF. Données. Générateur de données
- Interview must ask: summary of ten classic sorting algorithms
- 【C语言】实现字符串截取功能
猜你喜欢

File contains (regardless of suffix) Apache log remote file contains PHP encapsulated pseudo protocol:

L1-066 cat is liquid (5 points)

SQL injection upload one sentence Trojan horse (turn)

How to count the total length of roads in the region and draw data histogram

Solid programming concepts

JWT學習與使用

Install pycharm under Kali and create a shortcut access

Bearpi IOT lighting LED

ShanMeng and Beijing Adoption Day start NFT digital collection public offering

Big manufacturers compete to join rust, performance and safety are the key, and the 2021 rust developer survey report is announced
随机推荐
In the era of smart retail, Weimeng reshapes the value of "shopping guide"
How to clear floating, and how does it work?
Shandong University network security range experimental platform -- team and project introduction
2022 examination questions and simulation examination for crane driver (limited to bridge crane)
1008 color classification
JWT learning and use
L1-066 cat is liquid (5 points)
Parallelization of accelerated training tf data. Dataset generator
When the build When gradle does not load the dependencies, and you need to add a download path in libraries, the path in gradle is not a direct downloadable path
Acquisition of Lai data, NPP data, GPP data and vegetation coverage data
A complete set of installation procedures (for learning and communication only)
JS controls the display and hiding of tags through class
1009 word search
Gao Xiang slam14 notes on three Lie groups and Lie algebra
New year news of osdu open underground data space Forum
Day18 creation and restoration of sparse array
How to quickly reference uview UL in uniapp, and introduce and use uviewui in uni app
National land use data of 30m precision secondary classification
[efficient] the most powerful development tool, ctool, is a compilation tool
Longest palindrome string