Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No object named 'DensePoseROIHeads' found in 'ROI_HEADS' registry! #5170

Open
FurkanGozukara opened this issue Dec 5, 2023 · 6 comments
Open

Comments

@FurkanGozukara
Copy link

I have installed and working. But there is literally 0 documentation and examples.

in the same folder densepose_rcnn_R_101_FPN_DL_s1x.yaml located
in the same folder Base-DensePose-RCNN-FPN.yaml located
in the same folder model_final_844d15.pkl located
in the same folder R-101.pkl located

my aim is giving a video and generating DensePose video like below

running2.mp4

my script is as below

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
from config import add_densepose_config
from detectron2.modeling import ROI_HEADS_REGISTRY


def setup_cfg():
    cfg = get_cfg()
    add_densepose_config(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

def process_video(input_video_path, output_video_path, cfg):
    video = cv2.VideoCapture(input_video_path)
    width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))
    height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
    fps = video.get(cv2.CAP_PROP_FPS)
    
    output_video = cv2.VideoWriter(output_video_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (width, height))
    
    predictor = DefaultPredictor(cfg)
    
    while True:
        ret, frame = video.read()
        if not ret:
            break

        outputs = predictor(frame)
        v = Visualizer(frame[:, :, ::-1], MetadataCatalog.get(cfg.DATASETS.TRAIN[0]), scale=1.2)
        output = v.draw_instance_predictions(outputs["instances"].to("cpu"))
        output_frame = output.get_image()[:, :, ::-1]

        output_video.write(output_frame)

    video.release()
    output_video.release()

cfg = setup_cfg()

process_video("ex1.mp4", "pose1.mp4", cfg)

the error i get is like below

Traceback (most recent call last):
  File "G:\magic_animate\compose_densepose\pose_maker.py", line 46, in <module>
    process_video("ex1.mp4", "pose1.mp4", cfg)
  File "G:\magic_animate\compose_densepose\pose_maker.py", line 27, in process_video
    predictor = DefaultPredictor(cfg)
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\detectron2\engine\defaults.py", line 282, in __init__
    self.model = build_model(self.cfg)
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\detectron2\modeling\meta_arch\build.py", line 22, in build_model
    model = META_ARCH_REGISTRY.get(meta_arch)(cfg)
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\detectron2\config\config.py", line 189, in wrapped
    explicit_args = _get_args_from_config(from_config_func, *args, **kwargs)
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\detectron2\config\config.py", line 245, in _get_args_from_config
    ret = from_config_func(*args, **kwargs)
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\detectron2\modeling\meta_arch\rcnn.py", line 77, in from_config
    "roi_heads": build_roi_heads(cfg, backbone.output_shape()),
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\detectron2\modeling\roi_heads\roi_heads.py", line 43, in build_roi_heads
    return ROI_HEADS_REGISTRY.get(name)(cfg, input_shape)
  File "G:\magic_animate\compose_densepose\detectron2\venv\lib\site-packages\fvcore\common\registry.py", line 71, in get
    raise KeyError(
KeyError: "No object named 'DensePoseROIHeads' found in 'ROI_HEADS' registry!"
Press any key to continue . . .
@github-actions github-actions bot added the needs-more-info More info is needed to complete the issue label Dec 5, 2023
Copy link

github-actions bot commented Dec 5, 2023

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";

@malleng
Copy link

malleng commented Dec 5, 2023

you can follow this tutorial : https://github.com/sangyun884/HR-VITON/issues/45

Hope this helps :)

@FurkanGozukara
Copy link
Author

you can follow this tutorial : https://github.com/sangyun884/HR-VITON/issues/45

Hope this helps :)

it returns nothing i mean the url

@malleng
Copy link

malleng commented Dec 5, 2023

you can follow this tutorial : https://github.com/sangyun884/HR-VITON/issues/45
Hope this helps :)

it returns nothing i mean the url

Yes sorry, is it better ? :

sangyun884/HR-VITON#45

@misaka-20000
Copy link

I met the same problem as you, did you solve the problem? If did, could you teach me how to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants