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
6b25743a
Commit
6b25743a
authored
6 years ago
by
wangg12
Browse files
Options
Downloads
Patches
Plain Diff
fix flake8
parent
7cbdbc78
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
mmdet/datasets/__init__.py
+3
-2
3 additions, 2 deletions
mmdet/datasets/__init__.py
mmdet/datasets/concat_dataset.py
+2
-3
2 additions, 3 deletions
mmdet/datasets/concat_dataset.py
mmdet/datasets/utils.py
+5
-3
5 additions, 3 deletions
mmdet/datasets/utils.py
tools/train.py
+0
-1
0 additions, 1 deletion
tools/train.py
with
10 additions
and
9 deletions
mmdet/datasets/__init__.py
+
3
−
2
View file @
6b25743a
...
...
@@ -5,6 +5,7 @@ from .utils import to_tensor, random_scale, show_ann, get_dataset
from
.concat_dataset
import
ConcatDataset
__all__
=
[
'
CustomDataset
'
,
'
CocoDataset
'
,
'
GroupSampler
'
,
'
DistributedGroupSampler
'
,
'
ConcatDataset
'
,
'
build_dataloader
'
,
'
to_tensor
'
,
'
random_scale
'
,
'
show_ann
'
,
'
get_dataset
'
'
CustomDataset
'
,
'
CocoDataset
'
,
'
GroupSampler
'
,
'
DistributedGroupSampler
'
,
'
ConcatDataset
'
,
'
build_dataloader
'
,
'
to_tensor
'
,
'
random_scale
'
,
'
show_ann
'
,
'
get_dataset
'
]
This diff is collapsed.
Click to expand it.
mmdet/datasets/concat_dataset.py
+
2
−
3
View file @
6b25743a
...
...
@@ -5,7 +5,7 @@ from torch.utils.data.dataset import ConcatDataset as _ConcatDataset
class
ConcatDataset
(
_ConcatDataset
):
"""
Same as torch.utils.data.dataset.ConcatDataset, but
Same as torch.utils.data.dataset.ConcatDataset, but
concat the group flag for image aspect ratio.
"""
def
__init__
(
self
,
datasets
):
...
...
@@ -13,7 +13,7 @@ class ConcatDataset(_ConcatDataset):
flag: Images with aspect ratio greater than 1 will be set as group 1,
otherwise group 0.
"""
super
(
ConcatDataset
,
self
).
__init__
(
datasets
)
super
(
ConcatDataset
,
self
).
__init__
(
datasets
)
if
hasattr
(
datasets
[
0
],
'
flag
'
):
flags
=
[]
for
i
in
range
(
0
,
len
(
datasets
)):
...
...
@@ -27,4 +27,3 @@ class ConcatDataset(_ConcatDataset):
else
:
sample_idx
=
idx
-
self
.
cumulative_sizes
[
dataset_idx
-
1
]
return
dataset_idx
,
sample_idx
This diff is collapsed.
Click to expand it.
mmdet/datasets/utils.py
+
5
−
3
View file @
6b25743a
...
...
@@ -9,6 +9,7 @@ import numpy as np
from
.concat_dataset
import
ConcatDataset
from
..
import
datasets
def
to_tensor
(
data
):
"""
Convert objects of various python types to :obj:`torch.Tensor`.
...
...
@@ -72,7 +73,8 @@ def show_ann(coco, img, ann_info):
def
get_dataset
(
data_cfg
):
if
isinstance
(
data_cfg
[
'
ann_file
'
],
list
)
or
isinstance
(
data_cfg
[
'
ann_file
'
],
tuple
):
if
isinstance
(
data_cfg
[
'
ann_file
'
],
list
)
or
\
isinstance
(
data_cfg
[
'
ann_file
'
],
tuple
):
ann_files
=
data_cfg
[
'
ann_file
'
]
dsets
=
[]
for
ann_file
in
ann_files
:
...
...
@@ -81,9 +83,9 @@ def get_dataset(data_cfg):
dset
=
obj_from_dict
(
data_info
,
datasets
)
dsets
.
append
(
dset
)
if
len
(
dsets
)
>
1
:
dset
=
ConcatDataset
(
dsets
)
dset
=
ConcatDataset
(
dsets
)
else
:
dset
=
dsets
[
0
]
else
:
dset
=
obj_from_dict
(
data_cfg
,
datasets
)
return
dset
\ No newline at end of file
return
dset
This diff is collapsed.
Click to expand it.
tools/train.py
+
0
−
1
View file @
6b25743a
...
...
@@ -2,7 +2,6 @@ from __future__ import division
import
argparse
from
mmcv
import
Config
from
mmcv.runner
import
obj_from_dict
from
mmdet
import
datasets
,
__version__
from
mmdet.apis
import
(
train_detector
,
init_dist
,
get_root_logger
,
...
...
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