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
f3c50d39
Commit
f3c50d39
authored
Nov 11, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use imagenet_utils for inception-bn
parent
33304beb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
26 deletions
+10
-26
examples/Inception/imagenet_utils.py
examples/Inception/imagenet_utils.py
+1
-0
examples/Inception/inception-bn.py
examples/Inception/inception-bn.py
+9
-26
No files found.
examples/Inception/imagenet_utils.py
0 → 120000
View file @
f3c50d39
../
ResNet
/
imagenet_utils
.
py
\ No newline at end of file
examples/Inception/inception-bn.py
View file @
f3c50d39
...
@@ -14,7 +14,9 @@ from tensorpack import *
...
@@ -14,7 +14,9 @@ from tensorpack import *
from
tensorpack.tfutils.symbolic_functions
import
*
from
tensorpack.tfutils.symbolic_functions
import
*
from
tensorpack.tfutils.summary
import
*
from
tensorpack.tfutils.summary
import
*
from
tensorpack.dataflow
import
dataset
from
tensorpack.dataflow
import
dataset
from
tensorpack.utils.gpu
import
get_nr_gpu
from
imagenet_utils
import
fbresnet_augmentor
,
get_imagenet_dataflow
TOTAL_BATCH_SIZE
=
64
*
6
TOTAL_BATCH_SIZE
=
64
*
6
NR_GPU
=
6
NR_GPU
=
6
...
@@ -25,8 +27,7 @@ INPUT_SHAPE = 224
...
@@ -25,8 +27,7 @@ INPUT_SHAPE = 224
Inception-BN model on ILSVRC12.
Inception-BN model on ILSVRC12.
See "Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift", arxiv:1502.03167
See "Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift", arxiv:1502.03167
This config reaches 71
%
single-crop validation accuracy after 150k steps with 6 TitanX.
This config reaches 73
%
single-crop validation accuracy after 300k steps with 6 GPUs.
Learning rate may need a different schedule for different number of GPUs (because batch size will be different).
"""
"""
...
@@ -129,30 +130,13 @@ class Model(ModelDesc):
...
@@ -129,30 +130,13 @@ class Model(ModelDesc):
def
get_data
(
train_or_test
):
def
get_data
(
train_or_test
):
isTrain
=
train_or_test
==
'train'
isTrain
=
train_or_test
==
'train'
ds
=
dataset
.
ILSVRC12
(
args
.
data
,
train_or_test
,
shuffle
=
True
if
isTrain
else
False
)
augs
=
fbresnet_augmentor
(
isTrain
)
meta
=
dataset
.
ILSVRCMeta
()
meta
=
dataset
.
ILSVRCMeta
()
pp_mean
=
meta
.
get_per_pixel_mean
()
pp_mean
=
meta
.
get_per_pixel_mean
()
augs
.
append
(
imgaug
.
MapImage
(
lambda
x
:
x
-
pp_mean
[
16
:
-
16
,
16
:
-
16
]))
if
isTrain
:
ds
=
get_imagenet_dataflow
(
args
.
data
,
train_or_test
,
BATCH_SIZE
,
augs
)
# TODO use the augmentor in GoogleNet
augmentors
=
[
imgaug
.
Resize
((
256
,
256
)),
imgaug
.
Brightness
(
30
,
False
),
imgaug
.
Contrast
((
0.8
,
1.2
),
True
),
imgaug
.
MapImage
(
lambda
x
:
x
-
pp_mean
),
imgaug
.
RandomCrop
((
224
,
224
)),
imgaug
.
Flip
(
horiz
=
True
),
]
else
:
augmentors
=
[
imgaug
.
Resize
((
256
,
256
)),
imgaug
.
MapImage
(
lambda
x
:
x
-
pp_mean
),
imgaug
.
CenterCrop
((
224
,
224
)),
]
ds
=
AugmentImageComponent
(
ds
,
augmentors
,
copy
=
False
)
ds
=
BatchData
(
ds
,
BATCH_SIZE
,
remainder
=
not
isTrain
)
if
isTrain
:
ds
=
PrefetchDataZMQ
(
ds
,
6
)
return
ds
return
ds
...
@@ -192,7 +176,6 @@ if __name__ == '__main__':
...
@@ -192,7 +176,6 @@ if __name__ == '__main__':
config
=
get_config
()
config
=
get_config
()
if
args
.
load
:
if
args
.
load
:
config
.
session_init
=
SaverRestore
(
args
.
load
)
config
.
session_init
=
SaverRestore
(
args
.
load
)
if
args
.
gpu
:
nr_tower
=
get_nr_gpu
()
nr_tower
=
len
(
args
.
gpu
.
split
(
','
))
assert
nr_tower
==
NR_GPU
assert
nr_tower
==
NR_GPU
launch_train_with_config
(
config
,
SyncMultiGPUTrainer
(
NR_GPU
))
launch_train_with_config
(
config
,
SyncMultiGPUTrainer
(
NR_GPU
))
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