Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
cc1f50e5
Commit
cc1f50e5
authored
Jul 06, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disturb svhn
parent
4cc274cb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
5 deletions
+71
-5
examples/DisturbLabel/README.md
examples/DisturbLabel/README.md
+10
-5
examples/DisturbLabel/svhn-disturb.py
examples/DisturbLabel/svhn-disturb.py
+61
-0
examples/DisturbLabel/svhn.png
examples/DisturbLabel/svhn.png
+0
-0
No files found.
examples/DisturbLabel/README.md
View file @
cc1f50e5
...
...
@@ -3,16 +3,21 @@
I ran into the paper
[
DisturbLabel: Regularizing CNN on the Loss Layer
](
https://arxiv.org/abs/1605.00055
)
on CVPR16,
which basically said that noisy data gives you better performance.
As many, I didn't believe the method and the results
at first
.
As many, I didn't believe the method and the results.
This is a simple mnist training script with DisturbLabel. It uses the architecture in the paper and
hyperparameters in my original
[
mnist example
](
examples
/mnist-convnet.py
)
. The results surprised me:
hyperparameters in my original
[
mnist example
](
..
/mnist-convnet.py
)
. The results surprised me:

Experiements
a
re repeated 15 times for p=0, 10 times for p=0.02 & 0.05, and 5 times for other values
Experiements
we
re repeated 15 times for p=0, 10 times for p=0.02 & 0.05, and 5 times for other values
of p. All experiements run for 100 epochs, with lr decay, which are enough for them to converge.
I suppose the disturb method works as a random noise to prevent SGD from getting stuck.
It doesn't work for harder problems such as SVHN (details to follow). And I don't believe
it will work for ImageNet.
However it didn't work for harder problems such as SVHN:

The SVHN experiement used the model & hyperparemeters as my original
[
svhn example
](
../svhn-digit-convnet.py
)
.
Experiements were all repeated 10 times to get the error bar.
And I don't believe it will work for ImageNet.
examples/DisturbLabel/svhn-disturb.py
0 → 100755
View file @
cc1f50e5
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# File: svhn-disturb.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import
tensorflow
as
tf
import
argparse
import
numpy
as
np
import
os
from
tensorpack
import
*
from
tensorpack.tfutils.symbolic_functions
import
*
from
tensorpack.tfutils.summary
import
*
from
disturb
import
DisturbLabel
import
imp
svhn_example
=
imp
.
load_source
(
'svhn_example'
,
'../svhn-digit-convnet.py'
)
Model
=
svhn_example
.
Model
get_config
=
svhn_example
.
get_config
def
get_data
():
d1
=
dataset
.
SVHNDigit
(
'train'
)
d2
=
dataset
.
SVHNDigit
(
'extra'
)
data_train
=
RandomMixData
([
d1
,
d2
])
data_train
=
DisturbLabel
(
data_train
,
args
.
prob
)
data_test
=
dataset
.
SVHNDigit
(
'test'
)
augmentors
=
[
imgaug
.
Resize
((
40
,
40
)),
imgaug
.
Brightness
(
30
),
imgaug
.
Contrast
((
0.5
,
1.5
)),
]
data_train
=
AugmentImageComponent
(
data_train
,
augmentors
)
data_train
=
BatchData
(
data_train
,
128
)
data_train
=
PrefetchData
(
data_train
,
5
,
5
)
augmentors
=
[
imgaug
.
Resize
((
40
,
40
))
]
data_test
=
AugmentImageComponent
(
data_test
,
augmentors
)
data_test
=
BatchData
(
data_test
,
128
,
remainder
=
True
)
return
data_train
,
data_test
svhn_example
.
get_data
=
get_data
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--gpu'
,
help
=
'comma separated list of GPU(s) to use.'
)
# nargs='*' in multi mode
parser
.
add_argument
(
'--load'
,
help
=
'load model'
)
parser
.
add_argument
(
'--prob'
,
help
=
'disturb prob'
,
type
=
float
,
required
=
True
)
args
=
parser
.
parse_args
()
if
args
.
gpu
:
os
.
environ
[
'CUDA_VISIBLE_DEVICES'
]
=
args
.
gpu
else
:
os
.
environ
[
'CUDA_VISIBLE_DEVICES'
]
=
'0'
config
=
get_config
(
args
.
prob
)
if
args
.
load
:
config
.
session_init
=
SaverRestore
(
args
.
load
)
if
args
.
gpu
:
config
.
nr_tower
=
len
(
args
.
gpu
.
split
(
','
))
QueueInputTrainer
(
config
)
.
train
()
examples/DisturbLabel/svhn.png
0 → 100644
View file @
cc1f50e5
22.7 KB
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