has been using is python2, and we decided to change it to python3.
many errors are print function, xrange function, easy to solve.
solution to the last error was reported, the card for a day, can not find a solution on the Internet, record:
error as follows:
Caused by op ‘PyFunc’, defined at:
File “/home/q/yd/Faster -rcnn-21 /tools/demo.py”, line 118, in < module>
net = get_network(args.demo_net)
File “/home/q/yd/ swift-rcnn-21 /tools/.. /lib/networks/factory.py”, line 29, in get_network
return network.vggnet_test ()
File “/home/q/yd/ quickly-rcnn-21 /tools/.. /lib/networks/ vggnet_test.py “, line 18, in init__,> self. Setup ()
File “/home/q/yd/Faster -rcnn-21 /tools/.. (proposal_layer(__feat_stride, anchor_scales, STR (‘TEST’), name=’rois’))
File “/home/q/yd/ quickly-rcnn-21 /tools/. Floatal_layer [proposal_layer]), [-1, 5], proposal_layer [proposal_layer], [proposal_layer] Name = name)
the File “/ home/q/anaconda3 envs/py35/lib/python3.5/site – packages/tensorflow/python/ops/script_ops py”, line 212, in py_func
input = inp, token = token, Tout = Tout, Name = name)
the File “/ home/q/anaconda3 envs/py35/lib/python3.5/site – packages/tensorflow/python/ops/gen_script_ops py”, line, 50 in _py_func
“PyFunc”, input = input, token = token, Tout = Tout, Name = name)
the File “/ home/q/anaconda3 envs/py35/lib/python3.5/site – packages/tensorflow/python/framework/op_def_library py”, line 787, In _apply_op_helper
op_def = op_def)
the File “/ home/q/anaconda3/envs/py35/lib/python3.5/site – packages/tensorflow/python/framework/ops. Py”, line 2956, In create_op
op_def = op_def)
the File “/ home/q/anaconda3/envs/py35/lib/python3.5/site – packages/tensorflow/python/framework/ops. Py”, line 1470,
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
UnknownError (see above for traceback): KeyError: b’TEST’
[[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/device:CPU:0″](rpn_cls_prob_reshape/_95, Rpn_bbox_pred /rpn_bbox_pred/_97, _arg_Placeholder_1_0_1, PyFunc/input_3, PyFunc/input_4, PyFunc/input_5)]]
[[Node: PyFunc/_99 = _Recv[client_terminated=false, recv_device=”/job:localhost/replica:0/task:0/device:GPU:0″, send_device=”/job:localhost/replica:0/task:0/device:CPU:0″, send_device_incarnation=1, tensor_name=”edge_218_PyFunc”, tensor_type=DT_FLOAT, _device=”/job:localhost/replica:0/task:0/device:GPU:0″]()]]
p>
p>
KeyError: b’TEST’,
after analysis, the final locating reason is that a ‘TEST’ string entered in tf initialization cannot be parsed.
error in the vgg_test.py file
(self.feed('rpn_cls_prob_reshape', 'rpn_bbox_pred', 'im_info') .proposal_layer(_feat_stride, anchor_scales, str('TEST'), name='rois'))
there is a ‘TEST’ that will be entered into the tb.py_func () function
cannot resolve reason unknown
the final solution is to assign a value of
directly to ‘TEST’ in the proposal_layer_tf.py file
cfg_key = 'TEST'
pre_nms_topN = cfg[cfg_key].RPN_PRE_NMS_TOP_N
post_nms_topN = cfg[cfg_key].RPN_POST_NMS_TOP_N
nms_thresh = cfg[cfg_key].RPN_NMS_THRESH
min_size = cfg[cfg_key].RPN_MIN_SIZE
with this in red, it works.
original code, syntax check is not wrong, only manually assign ‘TEST’ to cfg_key first to solve this problem.
p>
many on the web say that python2 and python3 are coded differently, plus utf-8, and the test doesn’t work.
p>
p>
Read More:
- How to Fix keyerror in Python dictionary lookup
- Python quote error: * * * keyerror: u ‘\ uxx’ [How to Solve]
- Python Pandas Error: KeyError: 0 [How to Solve]
- [Solved] raise KeyError(key) from err KeyError: ‘Dates‘
- Python Use sqlalchemy Error: pymssql.ProgrammingError: (102, b“Incorrect syntax near ‘(‘.DB-Lib error
- “EncoderDecoder: ‘mit_b1 is not in the backbone registry‘“ [How to Solve]
- [Solved] NPM install Error: check python checking for Python executable python2 in the PATH
- Python Time Module timestamp, Time string formatting and Conversion (13-bit timestamp)
- Error in sitecustomize set PYTHONVERBOSE for traceback KeyError: ‘PYTHONPATH’
- [Solved] Ubuntu18.04 Install pyqt5 error: Command “python setup.py egg_info“ failed with error code 1 in /tmp/pip-build-92
- Solve the problem of error reporting from scipy.misc import imread & imresize in Python
- Python server run code ModuleNotFoundError Error [How to Solve]
- [Solved] Command “python setup.py egg_info” failed with error code 1
- Xadmin Install Error: Command “python setup.py egg_info“ failed with error code 1 in C:\Users\ADMINI~1\AppDat
- Python algorithm for “anagram” judgment problem
- [Solved] command “python setup.py egg_info“ failed with error code 1
- YOLOX Model conversion error: [TensorRT] ERROR: runtime.cpp (25) – Cuda Error in allocate: 2 (out of memory)
- [Solved] flash initializate database error: Keyerror: ‘migrate’
- numpy.concatenate() 253rd; 38169Keyerror: 0 [How to Solve]