Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Swin-Transformer-Object-Detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wanggh
Swin-Transformer-Object-Detection
Commits
def3b4d6
Unverified
Commit
def3b4d6
authored
3 years ago
by
Yuxin Wu
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Refactor]: move pycocotools version check to when it is used (#4880)
Co-authored-by:
Yuxin Wu
<
ppwwyyxx@users.noreply.github.com
>
parent
ff38f207
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mmdet/datasets/coco.py
+7
-10
7 additions, 10 deletions
mmdet/datasets/coco.py
with
7 additions
and
10 deletions
mmdet/datasets/coco.py
+
7
−
10
View file @
def3b4d6
...
@@ -6,6 +6,7 @@ from collections import OrderedDict
...
@@ -6,6 +6,7 @@ from collections import OrderedDict
import
mmcv
import
mmcv
import
numpy
as
np
import
numpy
as
np
import
pycocotools
from
mmcv.utils
import
print_log
from
mmcv.utils
import
print_log
from
pycocotools.coco
import
COCO
from
pycocotools.coco
import
COCO
from
pycocotools.cocoeval
import
COCOeval
from
pycocotools.cocoeval
import
COCOeval
...
@@ -15,16 +16,6 @@ from mmdet.core import eval_recalls
...
@@ -15,16 +16,6 @@ from mmdet.core import eval_recalls
from
.builder
import
DATASETS
from
.builder
import
DATASETS
from
.custom
import
CustomDataset
from
.custom
import
CustomDataset
try
:
import
pycocotools
if
not
hasattr
(
pycocotools
,
'
__sphinx_mock__
'
):
# for doc generation
assert
pycocotools
.
__version__
>=
'
12.0.2
'
except
AssertionError
:
raise
AssertionError
(
'
Incompatible version of pycocotools is installed.
'
'
Run pip uninstall pycocotools first. Then run pip
'
'
install mmpycocotools to install open-mmlab forked
'
'
pycocotools.
'
)
@DATASETS.register_module
()
@DATASETS.register_module
()
class
CocoDataset
(
CustomDataset
):
class
CocoDataset
(
CustomDataset
):
...
@@ -53,6 +44,12 @@ class CocoDataset(CustomDataset):
...
@@ -53,6 +44,12 @@ class CocoDataset(CustomDataset):
Returns:
Returns:
list[dict]: Annotation info from COCO api.
list[dict]: Annotation info from COCO api.
"""
"""
if
not
getattr
(
pycocotools
,
'
__version__
'
,
'
0
'
)
>=
'
12.0.2
'
:
raise
AssertionError
(
'
Incompatible version of pycocotools is installed.
'
'
Run pip uninstall pycocotools first. Then run pip
'
'
install mmpycocotools to install open-mmlab forked
'
'
pycocotools.
'
)
self
.
coco
=
COCO
(
ann_file
)
self
.
coco
=
COCO
(
ann_file
)
self
.
cat_ids
=
self
.
coco
.
get_cat_ids
(
cat_names
=
self
.
CLASSES
)
self
.
cat_ids
=
self
.
coco
.
get_cat_ids
(
cat_names
=
self
.
CLASSES
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment