Reputation: 15
I am trying to train a custom dataset in yolov5. So I am trying to run it with an image size of 640x480 but it is not working.
python3 /YOLOv5/yolov5/train.py --img-size 640 480 --batch 8 --epochs 300 --data data.yaml --weights yolov5s.pt --cache
usage: train.py [-h] [--weights WEIGHTS] [--cfg CFG] [--data DATA] [--hyp HYP] [--epochs EPOCHS]
[--batch-size BATCH_SIZE] [--imgsz IMGSZ] [--rect] [--resume [RESUME]] [--nosave]
[--noval] [--noautoanchor] [--noplots] [--evolve [EVOLVE]] [--bucket BUCKET]
[--cache [CACHE]] [--image-weights] [--device DEVICE] [--multi-scale]
[--single-cls] [--optimizer {SGD,Adam,AdamW}] [--sync-bn] [--workers WORKERS]
[--project PROJECT] [--name NAME] [--exist-ok] [--quad] [--cos-lr]
[--label-smoothing LABEL_SMOOTHING] [--patience PATIENCE]
[--freeze FREEZE [FREEZE ...]] [--save-period SAVE_PERIOD]
[--local_rank LOCAL_RANK] [--entity ENTITY] [--upload_dataset [UPLOAD_DATASET]]
[--bbox_interval BBOX_INTERVAL] [--artifact_alias ARTIFACT_ALIAS]
train.py: error: unrecognized arguments: 480
def parse_opt(known=False): parser.add_argument('--imgsz', '--img', '--img-size', type=int, default=640, help='train, val image size (pixels)') (https://github.com/ultralytics/yolov5.git)
Upvotes: 0
Views: 5301
Reputation: 3476
--img-size
only takes one argument. Use:
python3 /YOLOv5/yolov5/train.py --img-size 640 --batch 8 --epochs 300 --data data.yaml --weights yolov5s.pt --cache
the height of the image will be adjusted accordingly, respecting the aspect ratio and stride needs.
Upvotes: 0