当前位置:网站首页>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

边栏推荐
- Please calculate the value of the following function recursively: PX (x, n) =x-x^2 +x^3- x^4+... (-1) n-1) (xn) n > 0 * * input format requirements: "%lf%d" prompt: "enter X and n:"
- JS disable mobile sharing
- cellular automaton
- SQL injection upload one sentence Trojan horse (turn)
- Asp. Net core EF value conversion
- Bearpi IOT serial port transceiver 1- normal mode
- Parallelization of accelerated training tf data. Dataset generator
- leetcode 263. Ugly number
- Redis learning notes (continuously updating)
- Musk promotes the development of fascinating new products partners remind important questions
猜你喜欢

Redis learning notes (continuously updating)

Gao Xiang slam14 notes on three Lie groups and Lie algebra

A complete set of installation procedures (for learning and communication only)

Data processing and data set preparation

2022 fusion welding and thermal cutting recurrent training question bank and simulation examination

New year news of osdu open underground data space Forum

Operation of simulated examination platform for 2022 safety officer-b certificate examination questions

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

C asynchronous programming (async and await) and asynchronous method synchronous invocation

kali下安装pycharm并创建快捷访问
随机推荐
Surface net radiation flux data, solar radiation data, rainfall data, air temperature data, sunshine duration, water vapor pressure distribution, wind speed and direction data, surface temperature
Ecosystem type distribution data, land use data, vegetation type distribution and nature reserve distribution data
Day18 creation and restoration of sparse array
Advanced MySQL knowledge points (7)
Gavin teacher's perception of transformer live class - rasa dialogue robot project practice in the field of education agency mode and core component source code analysis under the microservice of educ
Day17 array features array boundary array application traversal array multidimensional array creation and traversal arrays operation array bubble sort
Walking "daily question" and "DP"
[GIS tutorial] ArcGIS for sunshine analysis (with exercise data download)
JS to determine whether the tags of multiple classes are empty
【C语言】实现字符串截取功能
Force/release learning and sorting in IC Verification (6) research on the influence of wire type signals
【cjson】根节点注意事项
Sentinel-2 data introduction and download
The master programmer "plays" a C program that is not like C
Spatial distribution data of national multi-year average precipitation 1951-2021, temperature distribution data, evapotranspiration data, evaporation data, solar radiation data, sunshine data and wind
SQL injection upload one sentence Trojan horse (turn)
Transpiration and evapotranspiration (ET) data, potential evapotranspiration, actual evapotranspiration data, temperature data, rainfall data
Musk promotes the development of fascinating new products partners remind important questions
C asynchronous programming (async and await) and asynchronous method synchronous invocation
[C language] realize string interception function