Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: b'TEST' #14

Open
Granulated opened this issue Jan 17, 2017 · 3 comments
Open

KeyError: b'TEST' #14

Granulated opened this issue Jan 17, 2017 · 3 comments

Comments

@Granulated
Copy link

Granulated commented Jan 17, 2017

Hi! I'm trying to get TFFRCNN to work on my Arch Linux setup. Installation worked just fine (I had to convert the python 2 code to python 3 code using futurize --stage1 and --stage 2 and compiled the code using the makefile lines for a binary installation of Tensorflow/ gcc4). When I run the command python ./faster_rcnn/demo.py --model VGGnet_fast_rcnn_iter_150000.ckpt --gpu 1 I run into a KeyError, amongst other things. Anyone know what could be causing this? It seems to me like the wrong key b'TEST' is passed along instead of simply passing 'TEST' but that might just be my naive error analysis as well. Any help much appreciated!

Here's the output:

I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 1 2 3 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0:   Y Y Y Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 1:   Y Y Y Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 2:   Y Y Y Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 3:   Y Y Y Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX TITAN Black, pci bus id: 0000:0e:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:1) -> (device: 1, name: GeForce GTX TITAN Black, pci bus id: 0000:0c:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:2) -> (device: 2, name: GeForce GTX TITAN Z, pci bus id: 0000:08:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:3) -> (device: 3, name: GeForce GTX TITAN Z, pci bus id: 0000:07:00.0)
Tensor("Placeholder:0", shape=(?, ?, ?, 3), dtype=float32)
Tensor("conv5_3/conv5_3:0", shape=(?, ?, ?, 512), dtype=float32)
Tensor("rpn_conv/3x3/rpn_conv/3x3:0", shape=(?, ?, ?, 512), dtype=float32)
Tensor("rpn_cls_score/rpn_cls_score:0", shape=(?, ?, ?, 18), dtype=float32)
Tensor("rpn_cls_prob:0", shape=(?, ?, ?, ?), dtype=float32)
Tensor("Reshape_2:0", shape=(?, ?, ?, 18), dtype=float32)
Tensor("rpn_bbox_pred/rpn_bbox_pred:0", shape=(?, ?, ?, 36), dtype=float32)
Tensor("Placeholder_1:0", shape=(?, 3), dtype=float32)
Tensor("conv5_3/conv5_3:0", shape=(?, ?, ?, 512), dtype=float32)
Tensor("rois:0", shape=(?, 5), dtype=float32)
[<tf.Tensor 'conv5_3/conv5_3:0' shape=(?, ?, ?, 512) dtype=float32>, <tf.Tensor 'rois:0' shape=(?, 5) dtype=float32>]
Tensor("fc7/fc7:0", shape=(?, 4096), dtype=float32)
Loading network VGGnet_test...   done.
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/tensorflow/python/ops/script_ops.py", line 83, in __call__
    ret = func(*args)
  File "./faster_rcnn/../lib/rpn_msr/proposal_layer_tf.py", line 73, in proposal_layer
    pre_nms_topN  = cfg[cfg_key].RPN_PRE_NMS_TOP_N
KeyError: b'TEST'
W tensorflow/core/framework/op_kernel.cc:968] Internal: Failed to run py callback pyfunc_0: see error log.
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 972, in _do_call
    return fn(*args)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 954, in _run_fn
    status, run_metadata)
  File "/usr/lib/python3.5/contextlib.py", line 66, in __exit__
    next(self.gen)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/errors.py", line 463, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors.InternalError: Failed to run py callback pyfunc_0: see error log.
	 [[Node: PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_STRING, DT_INT32, DT_INT32], Tout=[DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](Reshape_2/_83, rpn_bbox_pred/rpn_bbox_pred/_85, _recv_Placeholder_1_0, PyFunc/input_3, PyFunc/input_4, PyFunc/input_5)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./faster_rcnn/demo.py", line 134, in <module>
    _, _ = im_detect(sess, net, im)
  File "./faster_rcnn/../lib/fast_rcnn/test.py", line 179, in im_detect
    feed_dict=feed_dict)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 717, in run
    run_metadata_ptr)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 915, in _run
    feed_dict_string, options, run_metadata)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 965, in _do_run
    target_list, options, run_metadata)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 985, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors.InternalError: Failed to run py callback pyfunc_0: see error log.
	 [[Node: PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_STRING, DT_INT32, DT_INT32], Tout=[DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](Reshape_2/_83, rpn_bbox_pred/rpn_bbox_pred/_85, _recv_Placeholder_1_0, PyFunc/input_3, PyFunc/input_4, PyFunc/input_5)]]

Caused by op 'PyFunc', defined at:
  File "./faster_rcnn/demo.py", line 124, in <module>
    net = get_network(args.demo_net)
  File "./faster_rcnn/../lib/networks/factory.py", line 25, in get_network
    return VGGnet_test()
  File "./faster_rcnn/../lib/networks/VGGnet_test.py", line 16, in __init__
    self.setup()
  File "./faster_rcnn/../lib/networks/VGGnet_test.py", line 61, in setup
    .proposal_layer(_feat_stride, anchor_scales, 'TEST', name='rois'))
  File "./faster_rcnn/../lib/networks/network.py", line 32, in layer_decorated
    layer_output = op(self, layer_input, *args, **kwargs)
  File "./faster_rcnn/../lib/networks/network.py", line 214, in proposal_layer
    [tf.float32]),
  File "/usr/lib/python3.5/site-packages/tensorflow/python/ops/script_ops.py", line 174, in py_func
    input=inp, token=token, Tout=Tout, name=name)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/ops/gen_script_ops.py", line 39, in _py_func
    name=name)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 749, in apply_op
    op_def=op_def)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2380, in create_op
    original_op=self._default_original_op, op_def=op_def)
  File "/usr/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1298, in __init__
    self._traceback = _extract_stack()

InternalError (see above for traceback): Failed to run py callback pyfunc_0: see error log.
	 [[Node: PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_STRING, DT_INT32, DT_INT32], Tout=[DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](Reshape_2/_83, rpn_bbox_pred/rpn_bbox_pred/_85, _recv_Placeholder_1_0, PyFunc/input_3, PyFunc/input_4, PyFunc/input_5)]]

@ohsnapitsjojo
Copy link

Just add cfg_key = cfg_key.decode("utf-8") on line 70 in proposal_layer_tf.py. It worked for me that way.

@opencvfun
Copy link

@ohsnapitsjojo Thank you ! You save my day !

@daiwc
Copy link

daiwc commented May 9, 2018

@Granulated could you share the fixed python3 code on your github?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants