dBeker / Faster-RCNN-TensorFlow-Python3

Tensorflow Faster R-CNN for Windows/Linux and Python 3 (3.5/3.6/3.7)
MIT License
609 stars 329 forks source link

AttributeError: 'NoneType' object has no attribute 'astype'. #41

Closed laterone closed 5 years ago

laterone commented 6 years ago

Traceback (most recent call last): File "F:/faster-rcnn/FasterRcnn/Faster-RCNN-TensorFlow-Python3.5-master/demo.py", line 143, in demo(sess, net, im_name) File "F:/faster-rcnn/FasterRcnn/Faster-RCNN-TensorFlow-Python3.5-master/demo.py", line 73, in demo scores, boxes = im_detect(sess, net, im) File "F:\faster-rcnn\FasterRcnn\Faster-RCNN-TensorFlow-Python3.5-master\lib\utils\test.py", line 94, in im_detect blobs, im_scales = _get_blobs(im) File "F:\faster-rcnn\FasterRcnn\Faster-RCNN-TensorFlow-Python3.5-master\lib\utils\test.py", line 67, in _get_blobs blobs['data'], im_scale_factors = _get_image_blob(im) File "F:\faster-rcnn\FasterRcnn\Faster-RCNN-TensorFlow-Python3.5-master\lib\utils\test.py", line 39, in _get_image_blob im_orig = im.astype(np.float32, copy=True) AttributeError: 'NoneType' object has no attribute 'astype'

yhs95 commented 6 years ago

I also encountered this problem, how do you solve it?

plin24 commented 5 years ago

Check for the directory of your testing image.

ZhengDigua commented 5 years ago

I also have this problem, have you solve it?

xiaozhang8tuo commented 5 years ago

我的路径名中有中文 导致这个问题 im_file = os.path.join(cfg.FLAGS2["data_dir"], 'demo', image_name) print(im_file) print(type(im_file)) im = cv2.imread(im_file) print(im) print(type(im))函数demo下加入如下语句 正常情况会输出~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Demo for data/demo/000457.jpg E:\pycharm\faster rcnn\FasterRcnn\Faster-RCNN-TensorFlow-Python3.5-master\data\demo\000457.jpg <class 'str'> [[[ 78 104 111] [ 55 78 80] [ 87 107 102] ... [ 35 53 52] [ 14 32 31] [ 27 45 44]]而不是none之类的 im_read 的调用有问题

540ul4rm6 commented 5 years ago

I solved the problem! It's because of the name! http://tn00343140a.pixnet.net/blog/post/303187670-Faster%20RCNN%E9%81%87%E5%88%B0AttributeError:%20'NoneType'%20object%20has%20no%20attribute%20'astype'