YOLOv5_Transfer Learning2

BERT·2023년 6월 15일
0

Perception

목록 보기
17/20

nuScenes > nuImages > samples > CAM_FRONT 데이터 확인

nuScenes2kitti

1

https://github.com/nutonomy/nuscenes-devkit
nuscenes-devkit/python-sdk/nuscenes/scripts/export_kitti.py
이용한 이미지 결과물

2

직접 변환 (대완 작업)

2000장 사용 결정
2435 이미지

Case 1

yoloandnu
Transfer Learning1의 kitti 데이터 & nuScenes 학습

cp ~/datasets/kitti/data_object_image_2/training/image_2/*.png ~/datasets/yoloandnu/img/
cp ~/datasets/kitti/data_object_label_2/training/label_2/*.txt ~/datasets/yoloandnu/labels/
cp ~/datasets/nu_yolo/img/*.jpg ~/datasets/yoloandnu/img/
cp ~/datasets/nu_yolo/labels/*.txt ~/datasets/yoloandnu/labels/

kitti 7,481 데이터

nuScenes 2,435 데이터

kitti 데이터 & nuScenes 7,481 + 2,435

훈련 디렉터리로 복사

cp /TL/datasets/yoloandnu/img/* TL/datasets/yolo/images/
cp /TL/datasets/yoloandnu/labels/* /TL/datasets/yolo/labels/

jpg -> png 변경
yolov5 container 사용
root@eaebb6b3b151:/

python3 utils/converter.py
rm /TL/datasets/yolo/images/*.jpg

convert2Yolo
convert2Yolo container 사용
root@deb95701588a:/

python3 convert2Yolo/example.py \
--datasets KITTI \
--img_path /TL/datasets/yolo/images \
--label /TL/datasets/yoloandnu/labels \
--convert_output_path "/TL/datasets/yolo/labels" \
--img_type ".png" \
--cls_list_file ../kitti.names

train.txt test.txt 생성
train : val = 8924 : 992

python3 utils/split.py 

yolov5
yolov5 container 사용
root@eaebb6b3b151:/

python3 \
train.py \
--img 640 \
--batch 16 \
--epochs 30 \
--data /TL/datasets/yolo/kitti.yaml \
--cfg models/yolov5s.yaml \
--name yoloandnu

Case 2

tl
Transfer Learning1의 kitti 데이터의 Car, Pedestrian 제거 후 학습

cp /TL/datasets/kitti/data_object_label_2/training/label_2/*.txt \
/TL/datasets/kitti_no_car_ped/label_2
python3 utils/exclude.py
제거 전제거 후

kitti 데이터 & nuScenes 7,481 + 2,435

cp /TL/datasets/kitti_no_car_ped/label_2/*.txt \
> /TL/datasets/yoloandnu_no/labels
cp /TL/datasets/nu_yolo/labels/*.txt \
> /TL/datasets/yoloandnu_no/labels/ 

convert2Yolo

yolo_path="/TL/datasets"
python3 convert2Yolo/example.py \
--datasets KITTI \
--img_path /TL/datasets/yolo/images \
--label "$yolo_path/yoloandnu_no/labels" \
--convert_output_path "$yolo_path/yolo/labels" \
--img_type ".png" \
--cls_list_file ../kitti.names

yolov5
Doncare가 없으므로 .yaml nc 8 로 수정

python3 \
train.py \
--img 640 \
--batch 16 \
--epochs 30 \
--data /TL/datasets/yolo/kitti.yaml \
--cfg models/yolov5s.yaml \
--name yoloandnu_no

0개의 댓글