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
d6b69bda
Commit
d6b69bda
authored
Dec 06, 2018
by
yhcao6
Browse files
add RepeatDataset
parent
a6ee0532
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
mmdet/datasets/__init__.py
mmdet/datasets/__init__.py
+2
-1
mmdet/datasets/repeat_dataset.py
mmdet/datasets/repeat_dataset.py
+18
-0
No files found.
mmdet/datasets/__init__.py
View file @
d6b69bda
...
@@ -3,9 +3,10 @@ from .coco import CocoDataset
...
@@ -3,9 +3,10 @@ from .coco import CocoDataset
from
.loader
import
GroupSampler
,
DistributedGroupSampler
,
build_dataloader
from
.loader
import
GroupSampler
,
DistributedGroupSampler
,
build_dataloader
from
.utils
import
to_tensor
,
random_scale
,
show_ann
,
get_dataset
from
.utils
import
to_tensor
,
random_scale
,
show_ann
,
get_dataset
from
.concat_dataset
import
ConcatDataset
from
.concat_dataset
import
ConcatDataset
from
.repeat_dataset
import
RepeatDataset
__all__
=
[
__all__
=
[
'CustomDataset'
,
'CocoDataset'
,
'GroupSampler'
,
'DistributedGroupSampler'
,
'CustomDataset'
,
'CocoDataset'
,
'GroupSampler'
,
'DistributedGroupSampler'
,
'ConcatDataset'
,
'build_dataloader'
,
'to_tensor'
,
'random_scale'
,
'ConcatDataset'
,
'build_dataloader'
,
'to_tensor'
,
'random_scale'
,
'show_ann'
,
'get_dataset'
'show_ann'
,
'get_dataset'
,
'RepeatDataset'
]
]
mmdet/datasets/repeat_dataset.py
0 → 100644
View file @
d6b69bda
import
numpy
as
np
class
RepeatDataset
(
object
):
def
__init__
(
self
,
dataset
,
repeat_times
):
self
.
dataset
=
dataset
self
.
repeat_times
=
repeat_times
if
hasattr
(
self
.
dataset
,
'flag'
):
self
.
flag
=
np
.
tile
(
self
.
dataset
.
flag
,
repeat_times
)
self
.
length
=
len
(
self
.
dataset
)
*
self
.
repeat_times
def
__getitem__
(
self
,
idx
):
return
self
.
dataset
[
idx
%
len
(
self
.
dataset
)]
def
__len__
(
self
):
return
self
.
length
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