Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
maskrcnn
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
人工智能
maskrcnn
Commits
862347d5
Commit
862347d5
authored
Apr 19, 2019
by
CoinCheung
Committed by
Francisco Massa
Apr 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add color jitter augmentation (#680)
* add color jitter augmentation * fix spelling
parent
1d6e9add
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
defaults.py
maskrcnn_benchmark/config/defaults.py
+6
-0
build.py
maskrcnn_benchmark/data/transforms/build.py
+7
-0
transforms.py
maskrcnn_benchmark/data/transforms/transforms.py
+18
-0
No files found.
maskrcnn_benchmark/config/defaults.py
View file @
862347d5
...
@@ -54,6 +54,12 @@ _C.INPUT.PIXEL_STD = [1., 1., 1.]
...
@@ -54,6 +54,12 @@ _C.INPUT.PIXEL_STD = [1., 1., 1.]
# Convert image to BGR format (for Caffe2 models), in range 0-255
# Convert image to BGR format (for Caffe2 models), in range 0-255
_C
.
INPUT
.
TO_BGR255
=
True
_C
.
INPUT
.
TO_BGR255
=
True
# Image ColorJitter
_C
.
INPUT
.
BRIGHTNESS
=
0.0
_C
.
INPUT
.
CONTRAST
=
0.0
_C
.
INPUT
.
SATURATION
=
0.0
_C
.
INPUT
.
HUE
=
0.0
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Dataset
# Dataset
...
...
maskrcnn_benchmark/data/transforms/build.py
View file @
862347d5
...
@@ -16,9 +16,16 @@ def build_transforms(cfg, is_train=True):
...
@@ -16,9 +16,16 @@ def build_transforms(cfg, is_train=True):
normalize_transform
=
T
.
Normalize
(
normalize_transform
=
T
.
Normalize
(
mean
=
cfg
.
INPUT
.
PIXEL_MEAN
,
std
=
cfg
.
INPUT
.
PIXEL_STD
,
to_bgr255
=
to_bgr255
mean
=
cfg
.
INPUT
.
PIXEL_MEAN
,
std
=
cfg
.
INPUT
.
PIXEL_STD
,
to_bgr255
=
to_bgr255
)
)
color_jitter
=
T
.
ColorJitter
(
brightness
=
cfg
.
INPUT
.
BRIGHTNESS
,
contrast
=
cfg
.
INPUT
.
CONTRAST
,
saturation
=
cfg
.
INPUT
.
SATURATION
,
hue
=
cfg
.
INPUT
.
HUE
,
)
transform
=
T
.
Compose
(
transform
=
T
.
Compose
(
[
[
color_jitter
,
T
.
Resize
(
min_size
,
max_size
),
T
.
Resize
(
min_size
,
max_size
),
T
.
RandomHorizontalFlip
(
flip_prob
),
T
.
RandomHorizontalFlip
(
flip_prob
),
T
.
ToTensor
(),
T
.
ToTensor
(),
...
...
maskrcnn_benchmark/data/transforms/transforms.py
View file @
862347d5
...
@@ -72,6 +72,24 @@ class RandomHorizontalFlip(object):
...
@@ -72,6 +72,24 @@ class RandomHorizontalFlip(object):
return
image
,
target
return
image
,
target
class
ColorJitter
(
object
):
def
__init__
(
self
,
brightness
=
None
,
contrast
=
None
,
saturation
=
None
,
hue
=
None
,
):
self
.
color_jitter
=
torchvision
.
transforms
.
ColorJitter
(
brightness
=
brightness
,
contrast
=
contrast
,
saturation
=
saturation
,
hue
=
hue
,)
def
__call__
(
self
,
image
,
target
):
image
=
self
.
color_jitter
(
image
)
return
image
,
target
class
ToTensor
(
object
):
class
ToTensor
(
object
):
def
__call__
(
self
,
image
,
target
):
def
__call__
(
self
,
image
,
target
):
return
F
.
to_tensor
(
image
),
target
return
F
.
to_tensor
(
image
),
target
...
...
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