Skip to content

TypeError: 'NoneType' object is not iterable #81

@GeneralJing

Description

@GeneralJing

/home/appuser/anaconda3/envs/centernet2/lib/python3.8/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2228.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Traceback (most recent call last):
File "projects/CenterNet2/demo.py", line 100, in
predictions, visualized_output = demo.run_on_image(
File "/home/idriver/projects/CenterNet2/projects/CenterNet2/predictor.py", line 83, in run_on_image
vis_output = visualizer.draw_instance_predictions(
File "/home/appuser/anaconda3/envs/centernet2/lib/python3.8/site-packages/detectron2-0.6-py3.8-linux-x86_64.egg/detectron2/utils/video_visualizer.py", line 111, in draw_instance_predictions
else [y[0] for y in filter(lambda x: x[1], zip(labels, visibilities))]
TypeError: 'NoneType' object is not iterable
本地使用的环境是在docker hub中找的一个docker环境,docker环境内部安装了detectron2,执行如下命令是可以正常显示检测结果的:
python projects/CenterNet2/demo.py --config-file projects/CenterNet2/configs/CenterNet2_R50_1x.yaml --input ./images/ --opts MODEL.WEIGHTS models/CenterNet2_R50_1x.pth。
我想导出onnx model,所以使用tools/deploy/export_model.py文件,但是docker环境中的detectron2没有这个文件需要的依赖文件,所以我在docker内新建了一个虚拟环境,然后使用python setup.py build & install对本项目进行编译安装,再执行前面那个demo.py的命令的时候就报错了,对比detectron2 中的video_visualizer.py可以看出detectron2的内容是不一样的,想问下为什么会报错?
这个是detectron2的bug吗?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions