用YOLOV3训练自己的数据集(Pytorch版)

参考连接:http://t.csdn.cn/ay3lw

 (这位大大已经写的很详细了,在这里补充自己复现并且在参考链接中没有提及的细节)

 1.关于下载的YOLOv3项目中没有cfg文件:有cfg文件的是YOLOV3-v6以下的版本,下载的时候可以对并版本下载。

 2.修改filter数目,在配置文件的每一个yolo层上修改,注意不要看漏!!!

 3.不知道如下运行这个脚本问题。第一:先下载darknet这个项目,在这个项目下命令行先make一下,即输入'make'后按回车运行,然后将yolov3-tiny.cfg和yolov3-tiny.weights直接复制到darknet这个根目录下,然后输入下面图中给的脚本运行,在根目录下就有相应文件。

 

4.所遇代码问题:RuntimeError: result type Float can't be cast to the desired output type long int

Traceback (most recent call last):
  File "train.py", line 537, in <module>
    train(hyp, opt, device, tb_writer, wandb)
  File "train.py", line 288, in train
    loss, loss_items = compute_loss(pred, targets.to(device), model)  # loss scaled by batch_size
  File "/home/zhoujing/oj-hyn/YOLOV4/utils/loss.py", line 66, in compute_loss
    tcls, tbox, indices, anchors = build_targets(p, targets, model)  # targets
  File "/home/zhoujing/oj-hyn/YOLOV4/utils/loss.py", line 167, in build_targets
    indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1)))  # image, anchor, grid indices
RuntimeError: result type Float can't be cast to the desired output type long int

 将utils下的loss.py中gain = torch.ones(6, device=targets.device)改为gain = torch.ones(6, device=targets.device).long()即可。
原因是新版本的torch无法自动执行此转换,旧版本torch可以。

 5.AttributeError: '_OpNamespace' object has no attribute 'nms'

 python版本问题

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值