Error Box 之 'float' object cannot be interpreted as an integer

TypeError: 'float' object cannot be interpreted as an integer

boxes = 0
boxes = caffe_bias.shape[0] / 91
if output_name.find('BoxEncodingPredictor') != -1:
    tmp = caffe_bias.reshape(boxes, 4).copy()

python2/只留下了整数部分,去掉了小数,是int型。

而在python3里,/的结果是真正意义上的除法,结果是float型。boxes赋值为float型。

解决方法

boxes = 0
boxes = int(caffe_bias.shape[0] / 91)
if output_name.find('BoxEncodingPredictor') != -1:
    tmp = caffe_bias.reshape(boxes, 4).copy()

 

你可能感兴趣的:(Error,Box)