open-mmlab / mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
https://mmpose.readthedocs.io/en/latest/
Apache License 2.0
5.91k stars 1.26k forks source link

ImportError and FileNotFoundError #930

Closed TianQingX closed 3 years ago

TianQingX commented 3 years ago

When I try to run a top-down demo for video file, it report two error. Is this relate to I run detectors file from other package? or the video form has to be mp4?

$ python demo/top_down_video_demo_with_mmdet.py \

/home/x/anaconda3/envs/vipnas/lib/python3.8/site-packages/mmdet/models/detectors/yolox.py\
yolox_tiny_8x8_300e_coco_20210806_234250-4ff3b67e.pth \
configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/vipnas_res50_coco_256x192.py \
checkpoints/vipnas_res50_coco_256x192-cc43b466_20210624.pth \
--video-path /home/x/Downloads/snco/biisc/videos/S001_M_CALL_STD_FCE.avi \
--out-video-root /home/x/Downloads/snco/biisc_outpuy \
--show

Traceback (most recent call last): File "demo/top_down_video_demo_with_mmdet.py", line 164, in main() File "demo/top_down_video_demo_with_mmdet.py", line 73, in main det_model = init_detector( File "/home/x/anaconda3/envs/vipnas/lib/python3.8/site-packages/mmdet/apis/inference.py", line 32, in init_detector config = mmcv.Config.fromfile(config) File "/home/x/anaconda3/envs/vipnas/lib/python3.8/site-packages/mmcv/utils/config.py", line 315, in fromfile cfg_dict, cfg_text = Config._file2dict(filename, File "/home/x/anaconda3/envs/vipnas/lib/python3.8/site-packages/mmcv/utils/config.py", line 205, in _file2dict mod = import_module(temp_module_name) File "/home/x/anaconda3/envs/vipnas/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/tmp/tmpe978l75e/tmpj08blrrs.py", line 2, in ImportError: attempted relative import with no known parent package Exception ignored in: <function _TemporaryFileCloser.del at 0x7f3e2929ed30> Traceback (most recent call last): File "/home/x/anaconda3/envs/vipnas/lib/python3.8/tempfile.py", line 440, in del self.close() File "/home/x/anaconda3/envs/vipnas/lib/python3.8/tempfile.py", line 436, in close unlink(self.name) FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpe978l75e/tmpj08blrrs.py'

jin-s13 commented 3 years ago

@liqikai9 Could you help check this problem?

liqikai9 commented 3 years ago

Please run the demo script follow this template.

python demo/top_down_video_demo_with_mmdet.py \
    ${MMDET_CONFIG_FILE} ${MMDET_CHECKPOINT_FILE} \
    ${MMPOSE_CONFIG_FILE} ${MMPOSE_CHECKPOINT_FILE} \
    --video-path ${VIDEO_FILE} \
    --out-video-root ${OUTPUT_VIDEO_ROOT} \
    [--show --device ${GPU_ID or CPU}] \
    [--bbox-thr ${BBOX_SCORE_THR} --kpt-thr ${KPT_SCORE_THR}]

It seems that your path to ${MMDET_CONFIG_FILE}, $mmdetection/mmdet/models/detectors/yolox.py , is not appropriate. It should be a path like $mmdetection/configs/yolox/yolox_s_8x8_300e_coco.py. You can change this field and have a try.