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
4bb293dd
Commit
4bb293dd
authored
Mar 10, 2019
by
Kai Chen
Browse files
allow specifying multi-scale random mode
parent
85c30cc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
mmdet/datasets/custom.py
mmdet/datasets/custom.py
+7
-1
No files found.
mmdet/datasets/custom.py
View file @
4bb293dd
...
...
@@ -40,6 +40,7 @@ class CustomDataset(Dataset):
img_prefix
,
img_scale
,
img_norm_cfg
,
multiscale_mode
=
'value'
,
size_divisor
=
None
,
proposal_file
=
None
,
num_max_proposals
=
1000
,
...
...
@@ -73,6 +74,10 @@ class CustomDataset(Dataset):
# normalization configs
self
.
img_norm_cfg
=
img_norm_cfg
# multi-scale mode (only applicable for multi-scale training)
self
.
multiscale_mode
=
multiscale_mode
assert
multiscale_mode
in
[
'value'
,
'range'
]
# max proposals per image
self
.
num_max_proposals
=
num_max_proposals
# flip ratio
...
...
@@ -196,7 +201,8 @@ class CustomDataset(Dataset):
# apply transforms
flip
=
True
if
np
.
random
.
rand
()
<
self
.
flip_ratio
else
False
img_scale
=
random_scale
(
self
.
img_scales
)
# sample a scale
# randomly sample a scale
img_scale
=
random_scale
(
self
.
img_scales
,
self
.
multiscale_mode
)
img
,
img_shape
,
pad_shape
,
scale_factor
=
self
.
img_transform
(
img
,
img_scale
,
flip
,
keep_ratio
=
self
.
resize_keep_ratio
)
img
=
img
.
copy
()
...
...
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