yolov5的train.py的参数信息解析

parser = argparse.ArgumentParser()
parser.add_argument('--weights', type=str, default='yolov5s.pt', help='initial weights path')
parser.add_argument('--cfg', type=str, default='', help='model.yaml path')
parser.add_argument('--data', type=str, default='data/coco128.yaml', help='data.yaml path')
parser.add_argument('--hyp', type=str, default='data/hyp.scratch.yaml', help='hyperparameters path')
parser.add_argument('--epochs', type=int, default=10)
parser.add_argument('--batch-size', type=int, default=2, help='total batch size for all GPUs')
parser.add_argument('--img-size', nargs='+', type=int, default=[640, 640], help='[train, test] image sizes')
parser.add_argument('--rect', action='store_true', help='rectangular training')
parser.add_argument('--resume', nargs='?', const=True, default=False, help='resume most recent training')
parser.add_argument('--nosave', action='store_true', help='only save final checkpoint')
parser.add_argument('--notest', action='store_true', help='only test final epoch')
parser.add_argument('--noautoanchor', action='store_true', help='disable autoanchor check')
parser.add_argument('--evolve', action='store_true', help='evolve hyperparameters')
parser.add_argument('--bucket', type=str, default='', help='gsutil bucket')
parser.add_argument('--cache-images', action='store_true', help='cache images for faster training')
parser.add_argument('--image-weights', action='store_true', help='use weighted image selection for training')
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
parser.add_argument('--multi-scale', action='store_true', help='vary img-size +/- 50%%')
parser.add_argument('--single-cls', action='store_true', help='train multi-class data as single-class')
parser.add_argument('--adam', action='store_true', help='use torch.optim.Adam() optimizer')
parser.add_argument('--sync-bn', action='store_true', help='use SyncBatchNorm, only available in DDP mode')
parser.add_argument('--local_rank', type=int, default=-1, help='DDP parameter, do not modify')
parser.add_argument('--log-imgs', type=int, default=16, help='number of images for W&B logging, max 100')
parser.add_argument('--log-artifacts', action='store_true', help='log artifacts, i.e. final trained model')
parser.add_argument('--workers', type=int, default=0, help='maximum number of dataloader workers')
parser.add_argument('--project', default='runs/train', help='save to project/name')
parser.add_argument('--name', default='exp', help='save to project/name')
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
parser.add_argument('--quad', action='store_true', help='quad dataloader')
opt = parser.parse_args()
  • --weights: 初始权重路径,默认为'yolov5s.pt'。
  • --cfg: model.yaml文件路径,默认为空字符串。
  • --data: data.yaml文件路径,默认为'data/coco128.yaml'。
  • --hyp: 超参数文件路径,默认为'data/hyp.scratch.yaml'。
  • --epochs: 训练的总轮数,默认为10。
  • --batch-size: 所有GPU的总批量大小,默认为2。
  • --img-size: 图像尺寸,包括训练和测试图像尺寸,默认为[640, 640]。
  • --rect: 是否使用矩形训练,默认为False。
  • --resume: 是否恢复最近的训练,默认为False。
  • --nosave: 是否仅保存最终检查点,默认为False。
  • --notest: 是否仅测试最终轮次,默认为False。
  • --noautoanchor: 是否禁用自动锚点检查,默认为False。
  • --evolve: 是否进行超参数进化,默认为False。
  • --bucket: gsutil存储桶,默认为空字符串。
  • --cache-images: 是否缓存图像以加快训练速度,默认为False。
  • --image-weights: 是否使用加权图像选择进行训练,默认为False。
  • --device: CUDA设备,例如0或0,1,2,3或cpu,默认为空字符串。
  • --multi-scale: 是否在图像尺寸上变化+/- 50%,默认为False。
  • --single-cls: 是否将多类数据作为单类进行训练,默认为False。
  • --adam: 是否使用torch.optim.Adam()优化器,默认为False。
  • --sync-bn: 是否使用SyncBatchNorm,仅在DDP模式下可用,默认为False。
  • --local_rank: DDP参数,不要修改,默认为-1。
  • --log-imgs: W&B日志中要记录的图像数量,最大为100,默认为16。
  • --log-artifacts: 是否记录工件,例如最终训练模型,默认为False。
  • --workers: 数据加载器的最大工作进程数,默认为0。
  • --project: 保存到的项目/名称,默认为'runs/train'。
  • --name: 保存到的项目/名称,默认为'exp'。
  • --exist-ok: 如果项目/名称已存在,则允许存在,不增加计数,默认为False。
  • --quad: 是否使用四重数据加载器,默认为False。

这些参数可以通过命令行传递给程序,以便根据需要自定义训练过程。

  • 19
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

nanshaws

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值