From 13458cd4a2bbbc750e12e8cace4a5b92208eac03 Mon Sep 17 00:00:00 2001 From: "Kin-Yiu, Wong" <102582011@cc.ncu.edu.tw> Date: Sun, 24 Jul 2022 22:26:53 +0800 Subject: [PATCH] main code update readme --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2b98a8fa..35c30843 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ MS COCO Docker environment (recommended)
Expand -``` bash +``` shell # create the docker container, you can change the share memory size if you have more. nvidia-docker run --name yolov7 -it -v your_coco_path/:/coco/ -v your_code_path/:/yolov7 --shm-size=64g nvcr.io/nvidia/pytorch:21.08-py3 @@ -57,7 +57,7 @@ cd /yolov7 [`yolov7.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt) [`yolov7x.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7x.pt) [`yolov7-w6.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6.pt) [`yolov7-e6.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6.pt) [`yolov7-d6.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-d6.pt) [`yolov7-e6e.pt`](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt) -``` bash +``` shell python test.py --data data/coco.yaml --img 640 --batch 32 --conf 0.001 --iou 0.65 --device 0 --weights yolov7.pt --name yolov7_640_val ``` @@ -84,7 +84,7 @@ To measure accuracy, download [COCO-annotations for Pycocotools](http://images.c Data preparation -``` bash +``` shell bash scripts/get_coco.sh ``` @@ -92,7 +92,7 @@ bash scripts/get_coco.sh Single GPU training -``` bash +``` shell # train p5 models python train.py --workers 8 --device 0 --batch-size 32 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml @@ -102,7 +102,7 @@ python train_aux.py --workers 8 --device 0 --batch-size 16 --data data/coco.yaml Multiple GPU training -``` bash +``` shell # train p5 models python -m torch.distributed.launch --nproc_per_node 4 --master_port 9527 train.py --workers 8 --device 0,1,2,3 --sync-bn --batch-size 128 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml @@ -116,7 +116,7 @@ python -m torch.distributed.launch --nproc_per_node 8 --master_port 9527 train_a Single GPU finetuning for custom dataset -``` bash +``` shell # finetune p5 models python train.py --workers 8 --device 0 --batch-size 32 --data data/custom.yaml --img 640 640 --cfg cfg/training/yolov7-custom.yaml --weights 'yolov7_training.pt' --name yolov7-custom --hyp data/hyp.scratch.custom.yaml @@ -137,11 +137,12 @@ See [keypoint.ipynb](https://github.com/WongKinYiu/yolov7/blob/main/tools/keypoi ## Inference On video: -``` bash +``` shell python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source yourvideo.mp4 +``` On image: -``` bash +``` shell python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source inference/images/horses.jpg ```