facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
29.32k stars 7.32k forks source link

KeyError: 'Non-existent config key: MODEL.DENSEPOSE_ON' #5169

Closed FurkanGozukara closed 7 months ago

FurkanGozukara commented 7 months ago

I have installed like below

pip install git+https://github.com/facebookresearch/detectron2.git

it is working

the problem is when I try like below I am getting below error

I think you fixed this issue how?

@andrewjong @malcolmgarner-movement @ak9250

import cv2
import torch
from detectron2.engine import DefaultPredictor
from detectron2.config import get_cfg
from detectron2.utils.visualizer import Visualizer
from detectron2.data import MetadataCatalog

def setup_cfg():
    cfg = get_cfg()
    cfg.merge_from_file("densepose_rcnn_R_101_FPN_DL_s1x.yaml")
    cfg.MODEL.WEIGHTS = "model_final_844d15.pkl"
    cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
    return cfg
Traceback (most recent call last):
  File "G:\magic_animate\compose_densepose\pose_maker.py", line 45, in <module>
    process_video('ex1.mp4', 'output_video.mp4')
  File "G:\magic_animate\compose_densepose\pose_maker.py", line 18, in process_video
    cfg = setup_cfg()
  File "G:\magic_animate\compose_densepose\pose_maker.py", line 11, in setup_cfg
    cfg.merge_from_file("densepose_rcnn_R_50_FPN_s1x.yaml")
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\detectron2\config\config.py", line 69, in merge_from_file
    self.merge_from_other_cfg(loaded_cfg)
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\fvcore\common\config.py", line 132, in merge_from_other_cfg
    return super().merge_from_other_cfg(cfg_other)
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\yacs\config.py", line 217, in merge_from_other_cfg
    _merge_a_into_b(cfg_other, self, self, [])
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\yacs\config.py", line 478, in _merge_a_into_b
    _merge_a_into_b(v, b[k], root, key_list + [k])
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\yacs\config.py", line 491, in _merge_a_into_b
    raise KeyError("Non-existent config key: {}".format(full_key))
KeyError: 'Non-existent config key: MODEL.DENSEPOSE_ON'
Press any key to continue . . .
github-actions[bot] commented 7 months ago

You've chosen to report an unexpected problem or bug. Unless you already know the root cause of it, please include details about it by filling the issue template. The following information is missing: "Instructions To Reproduce the Issue and Full Logs"; "Your Environment";