Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
food-round2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joel Joseph
food-round2
Commits
a3c8ddf7
Unverified
Commit
a3c8ddf7
authored
6 years ago
by
Kai Chen
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #391 from hellock/master
allow specifying multi-scale random mode
parents
189d6097
4bb293dd
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/custom.py
+7
-1
7 additions, 1 deletion
mmdet/datasets/custom.py
with
7 additions
and
1 deletion
mmdet/datasets/custom.py
+
7
−
1
View file @
a3c8ddf7
...
...
@@ -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
()
...
...
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