YOLOv5_TSTL

BERT·2023년 6월 22일
0

Perception

목록 보기
19/20

yolov5

datasets file structure

도커 컨테이너와 연결시킬 datasets안에 생성

mkdir yolo_tstl yolo_tstl/images yolo_tstl/labels
touch yolo_tstl/train.txt yolo_tstl/test.txt yolo_tstl/tstl.yaml

tstl.yaml

train: /tstl/datasets/train.txt
val: /tstl/datasets/test.txt
nc: 8  # number of classes
names:
        0: left
        1: right
        2: stop
        3: crosswalk
        4: uturn
        5: traffic_light
        6: xycar
        7: ignore

docker

yolov5를 가동시킬 도커 컨테이너

docker pull ultralytics/yolov5:latest

docker run \
--ipc=host \
--name bert_tstl \
--gpus 2 \
-it \
-v ${PWD}/yolov5_tstl:/tstl \
-v ${PWD}/datasets/yolo_tstl:/tstl/datasets \
ultralytics/yolov5:latest

재진입

docker start bert_tstl \
&& docker exec -it bert_tstl /bin/bash

benchmarks

python benchmarks.py \
--weights yolov5s.pt \
--imgsz 640 \
--device 0

models/yolov5s.yaml
nc: 8 로 수정

train

python3 \
train.py \
--img 640 \
--batch 16 \
--epochs 100 \
--data /tstl/datasets/tstl.yaml \
--cfg models/yolov5s.yaml \
--weights yolov5s.pt \
--name tstl

export

model_export

python export.py \
--weights runs/train/tstl/weights/best.pt \
--include onnx

netron

snap install netron

best.onnx

detect

python detect.py --weights runs/train/tstl/weights/best.onnx
cp runs/detect /tstl/ -r

0개의 댓글