TSD icon indicating copy to clipboard operation
TSD copied to clipboard

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

Open mosheliv opened this issue 3 years ago • 1 comments

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!

mosheliv avatar Jan 10 '22 05:01 mosheliv

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?

rafaelpadilla avatar Jan 26 '22 21:01 rafaelpadilla