YOLOv5 Training
1. YOLOv5 git clone
git clone <https://github.com/ultralytics/yolov5> # clone
cd yolov5
pip install -r requirements.txt # ํ์ํ ํจํค์ง ์ค์น
2. dataset
roboflow์์ image์ label์ด ์ด๋ฏธ ์์ด์ ๋ค์ด๋ฐ์์คฌ๋ค
yolo v5 pothole detection median blur Object Detection Dataset by Parth Choksi
817 open source potholes images. yolo v5 pothole detection median blur dataset by Parth Choksi
universe.roboflow.com
- images
- labels
3. coco128.yaml ํ์ผ ์์
train: ../pothole_blur_dataset/train/images # ๋ฐ์ดํฐ์
train ๊ฒฝ๋ก
val: ../pothole_blur_dataset/valid/images # ๋ฐ์ดํฐ์
val ๊ฒฝ๋ก
nc: 1 # ํด๋์ค -> pothole 1๊ฐ
names: ['Potholes']
4. yolov5s.yaml ํ์ผ ์์
# Parameters
nc: 1 # number of classes
+ ์ต์ ๋ค๋ ์กฐ๊ธ์ฉ ์์ ํด์ฃผ์๋ค
5. YOLOv5 ํ์ธ
python detect.py --source # OPTION
0 # ์ฐ๊ฒฐ๋ webcam์์ ์ค์๊ฐ์ผ๋ก detect
ํ์ผ์ด๋ฆ.jpg # image
ํ์ผ์ด๋ฆ.mp4 # video
screen # screenshot
๋๋ ํฐ๋ฆฌ์ด๋ฆ/ # directory
'path/*.jpg' # glob
'<https://youtu.be/Zgi9g1ksQHc>' # YouTube
'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
6. YOLOv5 Training
python train.py --data data/coco128.yaml --cfg models/yolov5s.yaml --weights yolov5s.pt --img ์ค์ --batch ์ค์ --epochs ์ค์
7. test
python detect.py --source pothole_blur_dataset/train/images/1.jpg --weights runs/train/exp4/weights/best.pt
—source : ์ด๋ฏธ์ง
—weights : pre-trained ๋ชจ๋ธ
์ด๋ best.pt๋ ํ์ต์์ผ์ exp4์ ์์ฑ๋ ๊ฐ์ฅ ์ฑ๋ฅ์ด ์ข์ ๋ชจ๋ธ !
๋๋ ๋ฐ์ดํฐ์ ์ด images -> train / val, labels -> train / val ์ด ์๋๋ผ train -> images / labels, val -> images / labels ์ด๋ฐ ์์ผ๋ก ๋์ด์๋๋ฐ..
# ๋์ ๊ฒฝ์ฐ
train: ../pothole_blur_dataset/train/images
val: ../pothole_blur_dataset/valid/images
# ๋ณดํธ์ ์ธ ๊ฒฝ์ฐ
train: ../pothole_blur_dataset/images/train
val: ../pothole_blur_dataset/images/valid
ํ์ต๋ ์ ๋๋ก ๋๊ณ ๋๋ค train, val ์ด๋ฏธ์ง ํด๋ ๊ฒฝ๋ก๋ฅผ ๊ฐ๋ฆฌํค๋๊น ๋ฌธ์ ๋ ์์ด๋ณด์ด๊ธฐ๋ ํ์ง๋ง ๋ค์๋ถํฐ๋ ๋ณดํธ์ ์ด๊ฒ ๋๋ ์ผ์ง!
(label์ ์ด๋ป๊ฒ ์ ๋๋ก ์ฐพ์๊ฐ๋์ง ๋ชจ๋ฅด๊ฒ ๋ค..)
์ผ๋จ epochs๋ batch size ํฌ๊ฒ ๋๋ ค๋๊ณ ์๋ค~
's t u d y . . ๐ง > AI ์ค ML ์ค DL' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[YOLOv5] ํ์ต๋ ๋ชจ๋ธ๋ก ์ด๋ฏธ์ง test ํ ํ ํ์ผ์ ์ ์ฅํ๊ธฐ (0) | 2022.10.08 |
---|---|
[YOLOv5] YOLOv5 ์ฌ์ฉ๋ฒ (1) | 2022.10.07 |
[CNN] Custom Dataset์ผ๋ก Pothole detection (1) | 2022.10.05 |
[YOLOv3] Object Detection๊ณผ Bounding Box (0) | 2022.10.02 |
[DARKNET] ๋คํฌ๋ท์ผ๋ก YOLOV3 ๋๋ฆฌ๋ ๋ฒ (0) | 2022.10.02 |