CharlesShang / FastMaskRCNN

Mask RCNN in TensorFlow
Apache License 2.0
3.09k stars 1.1k forks source link

name 'xrange' is not defined #208

Closed jiangkeng123 closed 3 years ago

jiangkeng123 commented 5 years ago

Traceback (most recent call last):

File "", line 1, in runfile('/home/jiang/FastMaskRCNN/train/train.py', wdir='/home/jiang/FastMaskRCNN/train')

File "/home/jiang/anaconda3/envs/flappbird/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 678, in runfile execfile(filename, namespace)

File "/home/jiang/anaconda3/envs/flappbird/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 106, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "/home/jiang/FastMaskRCNN/train/train.py", line 338, in train()

File "/home/jiang/FastMaskRCNN/train/train.py", line 270, in train [input_image] + [final_box] + [final_cls] + [final_prob] + [final_gt_cls] + [gt] + [tmp_0] + [tmp_1] + [tmp_2] + [tmp_3] + [tmp_4])

File "/home/jiang/anaconda3/envs/flappbird/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 895, in run run_metadata_ptr)

File "/home/jiang/anaconda3/envs/flappbird/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1124, in _run feed_dict_tensor, options, run_metadata)

File "/home/jiang/anaconda3/envs/flappbird/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run options, run_metadata)

File "/home/jiang/anaconda3/envs/flappbird/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call raise type(e)(node_def, op, message)

UnknownError: NameError: name 'xrange' is not defined [[Node: pyramid_1/GenAnchors/PyFunc = PyFunc[Tin=[DT_INT32, DT_INT32, DT_INT32, DT_INT32], Tout=[DT_DOUBLE], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](pyramid_1/strided_slice, pyramid_1/strided_slice_1, pyramid_1/GenAnchors/PyFunc/input_2, pyramid_1/GenAnchors/PyFunc/input_3)]]

linccnu commented 5 years ago

python2.7 contains xrange and range, but python3.x has removed xrange.

superwhyun commented 3 years ago

If you are using python 3.x, just change 'xrange' to 'range'. it works.