https://github.com/WongKinYiu/yolov7/tree/pose
Pose estimation은 다음 링크를 사용한다.
GitHub - WongKinYiu/yolov7: Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time
Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors - GitHub - WongKinYiu/yolov7: Implementation of paper - YOLOv7: Trainable bag-of...
github.com
다른 task들과 같은 backbone을 쓰면서 동시에 popular task 중에 하나인 pose estimation을 마지막을 진행해보고자 한다.
다행히도 Yolov7 repo.에서 크게 바꾸지 않아도 무난히 실행 된다.
Keypoint dataset preparation
(새로 coco_kpts 폴더를 생성하고, 기존 coco 폴더에서 images & annotations 폴더를 copy 해서 사용)
Training on COCO
# Single GPU 경우
python train.py --data data/coco_kpts.yaml --cfg cfg/yolov7-w6-pose.yaml --weights '' --batch-size 128 --img 960 --kpt-label --device 0,1,2,3 --name yolov7-w6-pose --hyp data/hyp.pose.yaml
# Multiple GPU 경우 (이거 아직 안됨)
python -m torch.distributed.launch --nproc_per_node 8 --master_port 9527 train.py --data data/coco_kpts.yaml --cfg cfg/yolov7-w6-pose.yaml --weights '' --batch-size 128 --img 960 --kpt-label --sync-bn --device 0,1,2,3 --name yolov7-w6-pose --hyp data/hyp.pose.yaml
Trouble shooting during training
실험이 끝나고 model & config 은 runs/train/yolov7_w6_pose/ 에 저장된다
Inference on Image
python detect.py --weights yolov7-w6-pose.pt --kpt-label --source your_image.jpg
Inference on Video
python detect.py --weights yolov7-w6-pose.pt --kpt-label --source your_video.mp4
Arguments
주로 사용되는 argument는 다음과 같다
1. weights: pretrained model PATH
2. source: dataset PATH
3. img-size: image size during inference step
4. conf-thres: object confidence threshold (Yolo loss function 참고)
5. iou-threshold: IOU threshold (Yolo loss function 참고)
6. device: 사용할 device (e.g. 0 or 0,1,2,3 or cpu)
7. view-img: display results
8. save-txt: 결과 txt로 저장
9. save-conf: confidence socre 저장
10. nosave: 결과 저장 안함
11. classes: class 표시할지 여부 (e.g. --class 0, or --class 0 2 3)
12. project: project 저장할 폴더 PATH
13. name: project name (뒤에 숫자가 붙는 형식: e.g. exp1, exp2, ...)
14. nbbox: hide bounding boxes
15. kpt-label: key-point label (pose estimation에서는 반드시 사용해야 할 hyperparameter)
Results
Conclusion
생각보다 Inference는 너무 쉬워서 쉽게 따라할 수 있을 것 같다.
Detectron2 활용법 (2) - Dataloader & Data Augmentation (0) | 2022.10.14 |
---|---|
Detectron2 활용법 (1) - Dataset (0) | 2022.10.07 |
Yolov7 based Image Classification (0) | 2022.09.20 |
Yolov7 based Instance Segmentation (0) | 2022.09.19 |
Yolov7 based Object Detection (0) | 2022.09.19 |
댓글 영역