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
f30766aa
Commit
f30766aa
authored
Jun 27, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DoReFa inference preprocessor (fix #804)
parent
85303dd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
15 deletions
+2
-15
examples/DoReFa-Net/alexnet-dorefa.py
examples/DoReFa-Net/alexnet-dorefa.py
+2
-15
No files found.
examples/DoReFa-Net/alexnet-dorefa.py
View file @
f30766aa
...
@@ -172,24 +172,11 @@ def run_image(model, sess_init, inputs):
...
@@ -172,24 +172,11 @@ def run_image(model, sess_init, inputs):
)
)
predictor
=
OfflinePredictor
(
pred_config
)
predictor
=
OfflinePredictor
(
pred_config
)
meta
=
dataset
.
ILSVRCMeta
()
meta
=
dataset
.
ILSVRCMeta
()
pp_mean
=
meta
.
get_per_pixel_mean
()
pp_mean_224
=
pp_mean
[
16
:
-
16
,
16
:
-
16
,
:]
words
=
meta
.
get_synset_words_1000
()
words
=
meta
.
get_synset_words_1000
()
def
resize_func
(
im
):
transformers
=
imgaug
.
AugmentorList
(
fbresnet_augmentor
(
isTrain
=
False
))
h
,
w
=
im
.
shape
[:
2
]
scale
=
256.0
/
min
(
h
,
w
)
desSize
=
map
(
int
,
(
max
(
224
,
min
(
w
,
scale
*
w
)),
max
(
224
,
min
(
h
,
scale
*
h
))))
im
=
cv2
.
resize
(
im
,
tuple
(
desSize
),
interpolation
=
cv2
.
INTER_CUBIC
)
return
im
transformers
=
imgaug
.
AugmentorList
([
imgaug
.
MapImage
(
resize_func
),
imgaug
.
CenterCrop
((
224
,
224
)),
imgaug
.
MapImage
(
lambda
x
:
x
-
pp_mean_224
),
])
for
f
in
inputs
:
for
f
in
inputs
:
assert
os
.
path
.
isfile
(
f
)
assert
os
.
path
.
isfile
(
f
)
,
f
img
=
cv2
.
imread
(
f
)
.
astype
(
'float32'
)
img
=
cv2
.
imread
(
f
)
.
astype
(
'float32'
)
assert
img
is
not
None
assert
img
is
not
None
...
...
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