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

TypeError: FasterRCNN: __init__() got an unexpected keyword argument 'bbox_roi_extractor' #38

Open
mosheliv opened this issue Jan 10, 2022 · 1 comment

Comments

@mosheliv
Copy link

Hi,

I am trying to run TSD inside a docker using the following python (/lh points mapped the host directory)

from mmdet.apis import init_detector, inference_detector
import mmcv
import sys

config_file = '/lh/r50-FPN-1x_classsampling_TSD.py'
checkpoint_file = '/lh/r50-FPN-1x_classsampling_TSD.pth'

# build the model from a config file and a checkpoint file
model = init_detector(config_file, checkpoint_file, device='cuda:0')

# test a video and show the results
video = mmcv.VideoReader(sys.argv[1])
for frame in video:
    result = inference_detector(model, frame)
    model.show_result(frame, result, wait_time=1, out_file='/lh/out.jpg')
    break #just a test

I get the following:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg
    return obj_cls(**args)
TypeError: __init__() got an unexpected keyword argument 'bbox_roi_extractor'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/lh/inf.py", line 12, in <module>
    model = init_detector(config_file, checkpoint_file, device='cuda:0')
  File "/mmdetection/mmdet/apis/inference.py", line 40, in init_detector
    model = build_detector(config.model, test_cfg=config.get('test_cfg'))
  File "/mmdetection/mmdet/models/builder.py", line 59, in build_detector
    cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg))
  File "/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py", line 212, in build
    return self.build_func(*args, **kwargs, registry=self)
  File "/opt/conda/lib/python3.7/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "/opt/conda/lib/python3.7/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg
    raise type(e)(f'{obj_cls.__name__}: {e}')
TypeError: FasterRCNN: __init__() got an unexpected keyword argument 'bbox_roi_extractor'

this is using mmdetection 2.20. the docker is:

ARG PYTORCH="1.6.0"
ARG CUDA="10.1"
ARG CUDNN="7"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX"
ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"

RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install MMCV
RUN pip install mmcv-full==1.3.17 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html

# Install MMDetection
RUN conda clean --all
RUN git clone https://github.com/open-mmlab/mmdetection.git /mmdetection
WORKDIR /mmdetection
ENV FORCE_CUDA="1"
RUN pip install -r requirements/build.txt
RUN pip install --no-cache-dir -e .

Any help will be greatly appreciated!

@rafaelpadilla
Copy link

I am using the same model (r50-FPN-1x_classsampling_TSD.py and r50-FPN-1x_classsampling_TSD.pth) and having the same error:
"TypeError: init() got an unexpected keyword argument 'bbox_roi_extractor'"

Any suggestion?

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

2 participants