Faster-RCNN_TF
Faster-RCNN_TF copied to clipboard
TypeError: 'float' object cannot be interpreted as an integer
my python is 3.5,i use the 2to3.py to convert this program,i did the demo.py ,i want to train,when i follow the read me ,there are some errors.
First one is in def load():
- data_dict` = np.load(data_path).item() i change it to data_dict = np.load(data_path,encoding="latin1").item()
but the second question is when run it ,the error tell me that 'float' object cannot be interpreted as an integer,why? Who can help me
Loading pretrained model weights from data/pretrain_model/VGG_imagenet.npy assign pretrain model biases to conv5_1 assign pretrain model weights to conv5_1 assign pretrain model biases to conv4_1 assign pretrain model weights to conv4_1 assign pretrain model biases to conv1_1 assign pretrain model weights to conv1_1 assign pretrain model biases to conv2_1 assign pretrain model weights to conv2_1 assign pretrain model biases to conv4_2 assign pretrain model weights to conv4_2 assign pretrain model biases to conv3_3 assign pretrain model weights to conv3_3 assign pretrain model biases to conv3_2 assign pretrain model weights to conv3_2 assign pretrain model biases to conv3_1 assign pretrain model weights to conv3_1 assign pretrain model biases to conv5_3 assign pretrain model weights to conv5_3 assign pretrain model biases to conv1_2 assign pretrain model weights to conv1_2 assign pretrain model biases to conv4_3 assign pretrain model weights to conv4_3 ignore fc8 ignore fc8 assign pretrain model biases to fc6 assign pretrain model weights to fc6 assign pretrain model biases to fc7 assign pretrain model weights to fc7 assign pretrain model biases to conv5_2 assign pretrain model weights to conv5_2 assign pretrain model biases to conv2_2 assign pretrain model weights to conv2_2 2018-04-13 13:22:51.333218: W tensorflow/core/framework/op_kernel.cc:1158] Invalid argument: TypeError: 'float' object cannot be interpreted as an integer 2018-04-13 13:22:51.360653: W tensorflow/core/framework/op_kernel.cc:1158] Invalid argument: TypeError: 'float' object cannot be interpreted as an integer [[Node: roi-data/PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_INT32], Tout=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], token="pyfunc_2", _device="/job:localhost/replica:0/task:0/cpu:0"](rpn_rois/_105, _arg_Placeholder_2_0_2, roi-data/PyFunc/input_2)]] 2018-04-13 13:22:51.360714: W tensorflow/core/framework/op_kernel.cc:1158] Invalid argument: TypeError: 'float' object cannot be interpreted as an integer [[Node: roi-data/PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_INT32], Tout=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], token="pyfunc_2", _device="/job:localhost/replica:0/task:0/cpu:0"](rpn_rois/_105, _arg_Placeholder_2_0_2, roi-data/PyFunc/input_2)]] Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1139, in _do_call return fn(*args) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1121, in _run_fn status, run_metadata) File "/usr/lib/python3.5/contextlib.py", line 66, in exit next(self.gen) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: TypeError: 'float' object cannot be interpreted as an integer [[Node: roi-data/PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_INT32], Tout=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], token="pyfunc_2", _device="/job:localhost/replica:0/task:0/cpu:0"](rpn_rois/_105, _arg_Placeholder_2_0_2, roi-data/PyFunc/input_2)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./tools/train_net.py", line 96, in
Caused by op 'roi-data/PyFunc', defined at:
File "./tools/train_net.py", line 91, in
InvalidArgumentError (see above for traceback): TypeError: 'float' object cannot be interpreted as an integer [[Node: roi-data/PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_INT32], Tout=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], token="pyfunc_2", _device="/job:localhost/replica:0/task:0/cpu:0"](rpn_rois/_105, _arg_Placeholder_2_0_2, roi-data/PyFunc/input_2)]]
I met the same problem as yours, have you ever solved it?
I met the same problem as yours, have you ever solved it?
@Dennis-YB Change numpy version to 1.11 does not work. The above problem and https://github.com/smallcorgi/Faster-RCNN_TF/issues/231 are not the same problem
I met the same problem with #231, instead of changing the version to 1.11, I modified the code in lib/rpn_msr/proposal_target_layer_tf.py, line 138-139:
if bg_inds.size > 0: bg_inds = npr.choice(bg_inds, size=bg_rois_per_this_image, replace=False)
to
if bg_inds.size > 0: bg_inds = npr.choice(bg_inds, size=int(bg_rois_per_this_image), replace=False)
numpy.random.choice requires the second parameter to be a int type, you have to transform it manually in numpy>1.11
That works for me, try to find and modify the similar function calls in proposal_target_layer_tf.py if you still encounter the similar problems :)