[Refactor] Use pycocotools instead of mmpycocotools#4939
[Refactor] Use pycocotools instead of mmpycocotools#4939ZwwWayne merged 5 commits intoopen-mmlab:masterfrom
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. |
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.
Indicate that mmpycocotools works for both MMDet and Detectron2, so it will be fine if MMDetection is installed before Detectron2.
| try: | ||
| import lvis | ||
| assert lvis.__version__ >= '10.5.3' | ||
| if lvis.__version__ >= '10.5.3': |
There was a problem hiding this comment.
This will trigger an AttributeError for official LVIS
| 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.
this will print a warning for official pycocotools
|
@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:
mmpycocotoolsand officialpycocotoolhave the same package name. Users installpycocotoolsfirst fail to run MMDetection.As the
pycocotoolis maintained by the official team now, we decide to deprecate themmpycocotool. To make officialpycocotoolsworks 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