Faster R-CNN, ValueError, total size of new array must be unchanged

问题:ValueError: total size of new array must be unchanged

在用Faster Rcnn训练数集的时候,出现报错

I0730 20:59:18.449447 20748 
upgrade_proto.cpp:66] Attempting to upgrade 
input file specified using deprecated input 
fielTraceback (most recent call last): 

File "./tools/train_net.py", line 112, i <module> 
    max_iters=args.max_iters)
File "E:\1-XPJ\py-faster-rcnn\tools\..\lib\fast_rcnn\train.py", line 157, in train_net
pretrained_model=pretrained_model)
File "E:\1-XPJ\py-faster-rcnn\tools\..\lib\fast_rcnn\train.py", line 53, in __init__
self.solver.net.layers[0].set_roidb(roidb)
File "E:\1-XPJ\py-faster-rcnn\tools\..\lib\roi_data_layer\layer.py", line 68, in set_roidb
self._shuffle_roidb_inds()
File "E:\1-XPJ\py-faster-rcnn\tools\..\lib\roi_data_layer\layer.py", line 35, in _shuffle_roidb_inds
inds = np.reshape(inds, (-1, 2))
File "C:\Python27\lib\site-packages\numpy\core\fromnumeric.py", line 224, in reshape
return reshape(newshape, order=order)
ValueError: total size of new array must be unchanged
ds: data/imagenet_models/ZF.v2.caffemodel

问题分析

这里是 reshape方法报错,
reshape方法可以实现数组的变形,例如:

>>> from numpy import *
>>> a = array([1,2,3,4])
>>> a.reshape(2, 2)

<<< a = ([1,2],[3,4])

如果

>>> from numpy import *
>>> a = array([1,2,3])
>>> a.reshape(2, 2)

则会报错
ValueError: total size of new array must be unchanged

解决方案

确保tarin.txt, trainval.txt里的文件数量为偶数

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值