-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
[Refactor] Use pycocotools instead of mmpycocotools #4939
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4939 +/- ##
==========================================
- Coverage 65.63% 65.46% -0.18%
==========================================
Files 255 257 +2
Lines 19984 20053 +69
Branches 3394 3406 +12
==========================================
+ Hits 13117 13127 +10
- Misses 6165 6219 +54
- Partials 702 707 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
The refactoring LGTM. We should also tell users to switch to pycocotools if they already install mmpycocotools. |
PR message updated. |
docs/compatibility.md
Outdated
## pycocotools compatibility | ||
|
||
Before [PR 4939](https://github.com/open-mmlab/mmdetection/pull/4939), since `pycocotools` and `mmpycocotool` have the same package name, if users already installed `pyccocotools` (installed Detectron2 first under the same environment), then the setup of MMDetection will skip installing `mmpycocotool`. Thux MMDetection fails due to the missing `mmpycocotools`. | ||
[PR 4939](https://github.com/open-mmlab/mmdetection/pull/4939) deprecates mmpycocotools in favor official pycocotools. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in favor of
docs/compatibility.md
Outdated
|
||
## pycocotools compatibility | ||
|
||
Before [PR 4939](https://github.com/open-mmlab/mmdetection/pull/4939), since `pycocotools` and `mmpycocotool` have the same package name, if users already installed `pyccocotools` (installed Detectron2 first under the same environment), then the setup of MMDetection will skip installing `mmpycocotool`. Thux MMDetection fails due to the missing `mmpycocotools`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indicate that mmpycocotools
works for both MMDet and Detectron2, so it will be fine if MMDetection is installed before Detectron2.
@@ -277,17 +278,15 @@ def load_annotations(self, ann_file): | |||
|
|||
try: | |||
import lvis | |||
assert lvis.__version__ >= '10.5.3' | |||
if lvis.__version__ >= '10.5.3': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will trigger an AttributeError for official LVIS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx! Fixed in #4958
if not getattr(pycocotools, '__version__', '0') >= '12.0.2': | ||
warnings.warn( | ||
'mmpycocotools is deprecated. Please install official pycocotools by "pip install pycocotools"', # noqa: E501 | ||
UserWarning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will print a warning for official pycocotools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx! Fixed in #4958
@xvjiarui @ppwwyyxx @ZwwWayne The official pycocotools does not provide windows support because of this line in setup.py, how to use mmdetection on windows after this pr? |
|
@jinfagang i have opened a pr explaining the situation: #6838 |
Motivation:
mmpycocotools
and officialpycocotool
have the same package name. Users installpycocotools
first fail to run MMDetection.As the
pycocotool
is maintained by the official team now, we decide to deprecate themmpycocotool
. To make officialpycocotools
works with MMDetection, we add some function aliases forpycocotools.coco.COCO
.Besides, this PR makes users able to install MMDetection and Detectron2 under the same environment.
Fixed #4565