Detectron: NoneType' object has no attribute 'astype

Created on 27 Mar 2018  Â·  2Comments  Â·  Source: facebookresearch/Detectron

System information

when i tested the directory of image files of Inference with pretrained models, i have the "NoneType' object has no attribute 'astype“ error ,ask for help !thank you !

  • Operating system: ubuntu 14.04
  • Compiler version: 5.4.1
  • CUDA version: 8.0
  • cuDNN version: 6.0.21
  • NVIDIA driver version: 375.39
  • GPU models (for all devices if they are not all the same): ?
  • PYTHONPATH environment variable: ?
  • python --version output: 2.7.14
  • Anything else that seems relevant: ?
    amax@amax-workstation:~$ python /home/amax/detectron/tools/infer_simple.py --cfg /home/amax/detectron/configs/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml --output-dir /home/amax/Documents/sangyi/tmp/detectron-visualizations --image-ext /home/amax/detectron/demo/18124840932_e42b3e377c_k.jpg --wts https://s3-us-west-2.amazonaws.com/detectron/35861858/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml.02_32_51.SgT4y1cO/output/train/coco_2014_train:coco_2014_valminusminival/generalized_rcnn/model_final.pkl demo
    Found Detectron ops lib: /usr/local/lib/libcaffe2_detectron_ops_gpu.so
    E0327 15:54:12.570600 18905 init_intrinsics_check.cc:59] CPU feature avx is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
    E0327 15:54:12.570631 18905 init_intrinsics_check.cc:59] CPU feature avx2 is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
    E0327 15:54:12.570638 18905 init_intrinsics_check.cc:59] CPU feature fma is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
    WARNING cnn.py: 40: [====DEPRECATE WARNING====]: you are creating an object from CNNModelHelper class which will be deprecated soon. Please use ModelHelper object with brew module. For more information, please refer to caffe2.ai and python/brew.py, python/brew_test.py for more information.
    INFO net.py: 57: Loading weights from: /tmp/detectron-download-cache/35861858/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml.02_32_51.SgT4y1cO/output/train/coco_2014_train:coco_2014_valminusminival/generalized_rcnn/model_final.pkl
    I0327 15:54:18.933632 18905 net_dag_utils.cc:118] Operator graph pruning prior to chain compute took: 0.000151767 secs
    I0327 15:54:18.933917 18905 net_dag.cc:62] Number of parallel execution chains 63 Number of operators = 402
    I0327 15:54:18.958638 18905 net_dag_utils.cc:118] Operator graph pruning prior to chain compute took: 0.00012691 secs
    I0327 15:54:18.958843 18905 net_dag.cc:62] Number of parallel execution chains 30 Number of operators = 358
    I0327 15:54:18.960676 18905 net_dag_utils.cc:118] Operator graph pruning prior to chain compute took: 1.4157e-05 secs
    I0327 15:54:18.960717 18905 net_dag.cc:62] Number of parallel execution chains 5 Number of operators = 18
    INFO infer_simple.py: 112: Processing demo -> /home/amax/Documents/sangyi/tmp/detectron-visualizations/demo.pdf
    Traceback (most recent call last):
    File "/home/amax/detectron/tools/infer_simple.py", line 148, in
    main(args)
    File "/home/amax/detectron/tools/infer_simple.py", line 118, in main
    model, im, None, timers=timers
    File "/home/amax/detectron/lib/core/test.py", line 66, in im_detect_all
    model, im, cfg.TEST.SCALE, cfg.TEST.MAX_SIZE, boxes=box_proposals
    File "/home/amax/detectron/lib/core/test.py", line 137, in im_detect_bbox
    inputs, im_scale = _get_blobs(im, boxes, target_scale, target_max_size)
    File "/home/amax/detectron/lib/core/test.py", line 946, in _get_blobs
    blob_utils.get_image_blob(im, target_scale, target_max_size)
    File "/home/amax/detectron/lib/utils/blob.py", line 52, in get_image_blob
    im, cfg.PIXEL_MEANS, target_scale, target_max_size
    File "/home/amax/detectron/lib/utils/blob.py", line 108, in prep_im_for_blob
    im = im.astype(np.float32, copy=False)
    AttributeError: 'NoneType' object has no attribute 'astype'

Most helpful comment

You probably gives it an invalid (corrupted, unreadable by opencv) image.

All 2 comments

You probably gives it an invalid (corrupted, unreadable by opencv) image.

I had the same issue. I implemented an except cv2.error as e in my version of infer_simple.py but did not work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hwang-dae-won picture Hwang-dae-won  Â·  3Comments

olgaliak picture olgaliak  Â·  4Comments

kampelmuehler picture kampelmuehler  Â·  4Comments

fangpengcheng95 picture fangpengcheng95  Â·  4Comments

pacelu picture pacelu  Â·  3Comments