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

Compatibility to mmdet has been removed #1071

Open
nttjoshua opened this issue Mar 3, 2022 · 4 comments
Open

Compatibility to mmdet has been removed #1071

nttjoshua opened this issue Mar 3, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@nttjoshua
Copy link

nttjoshua commented Mar 3, 2022

🐛 Bug

Describe the bug
My team and I utilise databricks as our main platform for development. As such we are required to install our dependencies on a daily basis. This should be fine except for some unique behaviours that are breaking the compatibility of mmdet and icevision. This bug is two problems that are essentially the same result.

This is what we have learnt about mmcv and mmdet

  • mmcv requires installing with precompiled torch and cuda, using the -full https://... option. This requires knowing the versions on databricks.
  • To get the version run:
  • import torch
  • print(torch.version)
  • If you need to change the version cuda or torch for mmcv-full, then you need to uninstall it if the python version is unchanged.
  • Alternatively, --force-reinstall can be added to the pip install line to always reinstall this requirement

icevision==0.12.0 is not updated to changes in the api of mmdet in several places:

  • 'MultiScaleDeformableAttention'. mmdet==2.5.0 is the last release before backwards compatibility was dropped
  • 'CSPDarknet'. mmdet==2.15.1 is the first place this is found, however this release has a circular reference which gets hit in from ..utils import CSPLayer. This does not resolve for any versions between 2.15.1 and 2.22.0 (latest at the time of writing)
  • this does not change when downgrading icevision to 0.11.0
  • icevision is not currently compatible with mmdet>=2.15.1
  • icevision is not compatible with mmdet <=2.15.0 as there is hardcoded references to CSPDarknet in the code base

To Reproduce
Steps to reproduce the behavior:

  1. Install the following dependencies (Many different versions of this particular setup have been used with almost all combinations of mmdet and mmcv-full installations):
  1. Attempt to import the below
import gc
import os
import shutil
import multiprocessing as mp
import glob
import ast
import pandas as pd

from itertools import repeat
from icevision.all import *
from icevision.engines.fastai import *
from multiprocessing import Process, Manager, Pool
from icevision.models.ross import *
from icevision.models.mmdet.common import loss_fn
from icevision.models.mmdet.fastai.learner import *

Expected behaviour
Everything to be installed without errors.

Actual behaviour
One of the following errors (depending on which mmcv and mmdet versions are installed):

  • (with the above installs) - ModuleNotFoundError: No module named 'mmdet.models.backbones.csp_darknet'
  • (with mmdet==2.22.0) -
    ImportError: cannot import name 'CSPLayer' from 'mmdet.models.utils' (/databricks/python/lib/python3.8/site-packages/mmdet/models/utils/init.py)
  • (with mmcv==3.18.0 and mmdet==2.22.0) 'MultiScaleDeformableAttention' from 'mmcv.cnn.bricks.transformer'

Desktop (please complete the following information):

  • Linux version: 5.4.0-1067-azure
@nttjoshua nttjoshua added the bug Something isn't working label Mar 3, 2022
@FraPochetti
Copy link
Contributor

@dnth @ai-fast-track have you guys stumbled upon these issues?

@dnth
Copy link
Contributor

dnth commented Mar 3, 2022

I followed the steps in To Reproduce and I face the same error. However, I managed to solve the error with the following.

First reinstall pytorch to match the version specified when installing mmcv (in the mmcv installation the torch version specified is 1.10.0). pip install icevision==0.11.0 installs torch==1.10.2 which is a mismatch to the one of mmcv. Mmcv is very notorious with matching torch and cuda version to make it work.

So run the following
pip install torch==1.10.0+cu111 torchvision==0.11.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html

Next, update mmdet to more recent version. I tried with
pip install mmdet==2.17.0

I no longer face any of the errors. Let us know if it works for you :)

@rbavery
Copy link

rbavery commented May 4, 2022

I'm also encountering this error. @dnth 's solution worked for me.

@HaronCHou
Copy link

I'm also encountering this error. @dnth 's solution worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants