Pytorch_YOLOv3调试碰到的问题

首先说明我锁使用的是来自github的版本:
https://github.com/eriklindernoren/PyTorch-YOLOv3


大概也许会持续记录吧。。。我懒


记于2019.11.07

我的环境是

PackageVersion
Pillow6.2.1
pip19.3.1
tensorflow-gpu2.0.0
torch1.3.0
torchvision0.4.1
tqdm4.36.1
terminaltables3.1.0

如果你碰到这个问题:
File “pytorch_platform/PyTorch-YOLOv3/utils/logger.py”, line 7, in init
self.writer = tf.summary.FileWriter(log_dir)
AttributeError: module ‘tensorboard.summary._tf.summary’ has no attribute ‘FileWriter’

那么你可以尝试使用tensorflow2.0的升级脚本操作一下:

tf_upgrade_v2 --infile logger.py --outfile logger.py

不过十有八九还是有问题,我为了跑通网络直接在train.py中把所有的loger注释掉了。。。

如果你碰到这个讨厌的问题:
UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead

将model.py的191行,添加如下两句

obj_mask=obj_mask.bool() 	# convert int8 to bool
noobj_mask=noobj_mask.bool() 	#convert int8 to bool

改完之后训练就是这样的啦

---- [Epoch 0/100, Batch 48/58632] ----
+------------+--------------+--------------+--------------+
| Metrics    | YOLO Layer 0 | YOLO Layer 1 | YOLO Layer 2 |
+------------+--------------+--------------+--------------+
| grid_size  | 14           | 28           | 56           |
| loss       | 5.616557     | 6.428126     | 12.861836    |
| x          | 0.084134     | 0.053126     | 0.106777     |
| y          | 0.096309     | 0.087426     | 0.054314     |
| w          | 0.489871     | 0.298798     | 0.676306     |
| h          | 0.138098     | 0.316878     | 0.555535     |
| conf       | 4.742588     | 5.585589     | 11.308529    |
| cls        | 0.065557     | 0.086308     | 0.160376     |
| cls_acc    | 6.67%        | 6.25%        | 6.25%        |
| recall50   | 0.000000     | 0.000000     | 0.000000     |
| recall75   | 0.000000     | 0.000000     | 0.000000     |
| precision  | 0.000000     | 0.000000     | 0.000000     |
| conf_obj   | 0.030569     | 0.045765     | 0.107265     |
| conf_noobj | 0.010022     | 0.024203     | 0.086377     |
+------------+--------------+--------------+--------------+
Total loss 24.90652084350586
---- ETA 8:19:09.476121

2019.11.08


如果你电脑运行的时候提示 out of memery,请把batch_size改小。默认是8
在train.py中

parser.add_argument("--batch_size", type=int, default=8, help="size of each image batch")

以2080Ti为例,默认显存占用将近9个G
在这里插入图片描述

2019.11.12
训练Coco数据集开始一段时间后报错:
OSError: image file is truncated (9 bytes not processed)

在dataset.py中添加如下代码:

from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True

2019.11.12-2
将tensorflow版本降回到1.15,logger的错误能解决。
可以记录训练过程的参数了

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值