Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
SOLOv2-pytorch
Commits
ab5bca65
Unverified
Commit
ab5bca65
authored
Dec 06, 2018
by
Kai Chen
Committed by
GitHub
Dec 06, 2018
Browse files
Merge pull request #144 from yhcao6/RepeatDataset
repeat dataset
parents
65a2e5ea
2afb5a2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
mmdet/datasets/__init__.py
mmdet/datasets/__init__.py
+3
-2
mmdet/datasets/repeat_dataset.py
mmdet/datasets/repeat_dataset.py
+17
-0
mmdet/datasets/utils.py
mmdet/datasets/utils.py
+5
-0
No files found.
mmdet/datasets/__init__.py
View file @
ab5bca65
...
...
@@ -3,9 +3,10 @@ from .coco import CocoDataset
from
.loader
import
GroupSampler
,
DistributedGroupSampler
,
build_dataloader
from
.utils
import
to_tensor
,
random_scale
,
show_ann
,
get_dataset
from
.concat_dataset
import
ConcatDataset
from
.repeat_dataset
import
RepeatDataset
__all__
=
[
'CustomDataset'
,
'CocoDataset'
,
'GroupSampler'
,
'DistributedGroupSampler'
,
'ConcatDataset'
,
'build_dataloader'
,
'to_tensor'
,
'random_scale'
,
'
show_ann'
,
'get_d
ataset'
'build_dataloader'
,
'to_tensor'
,
'random_scale'
,
'show_ann'
,
'
get_dataset'
,
'ExtraAugmentation'
,
'ConcatDataset'
,
'RepeatD
ataset'
,
]
mmdet/datasets/repeat_dataset.py
0 → 100644
View file @
ab5bca65
import
numpy
as
np
class
RepeatDataset
(
object
):
def
__init__
(
self
,
dataset
,
times
):
self
.
dataset
=
dataset
self
.
times
=
times
if
hasattr
(
self
.
dataset
,
'flag'
):
self
.
flag
=
np
.
tile
(
self
.
dataset
.
flag
,
times
)
self
.
_original_length
=
len
(
self
.
dataset
)
def
__getitem__
(
self
,
idx
):
return
self
.
dataset
[
idx
%
self
.
_original_length
]
def
__len__
(
self
):
return
self
.
times
*
self
.
_original_length
mmdet/datasets/utils.py
View file @
ab5bca65
...
...
@@ -8,6 +8,7 @@ import torch
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
.concat_dataset
import
ConcatDataset
from
.repeat_dataset
import
RepeatDataset
from
..
import
datasets
...
...
@@ -74,6 +75,10 @@ def show_ann(coco, img, ann_info):
def
get_dataset
(
data_cfg
):
if
data_cfg
[
'type'
]
==
'RepeatDataset'
:
return
RepeatDataset
(
get_dataset
(
data_cfg
[
'dataset'
]),
data_cfg
[
'times'
])
if
isinstance
(
data_cfg
[
'ann_file'
],
(
list
,
tuple
)):
ann_files
=
data_cfg
[
'ann_file'
]
num_dset
=
len
(
ann_files
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment