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
05494dd6
Commit
05494dd6
authored
Dec 12, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix decoding
parent
be7eae86
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
7 deletions
+4
-7
examples/SuperResolution/data_sampler.py
examples/SuperResolution/data_sampler.py
+2
-1
examples/load-vgg16.py
examples/load-vgg16.py
+1
-3
examples/load-vgg19.py
examples/load-vgg19.py
+1
-3
No files found.
examples/SuperResolution/data_sampler.py
View file @
05494dd6
...
@@ -35,6 +35,7 @@ class ImageDataFromZIPFile(RNGDataFlow):
...
@@ -35,6 +35,7 @@ class ImageDataFromZIPFile(RNGDataFlow):
self
.
archivefiles
=
random
.
sample
(
self
.
archivefiles
,
self
.
max
)
self
.
archivefiles
=
random
.
sample
(
self
.
archivefiles
,
self
.
max
)
for
archive
in
self
.
archivefiles
:
for
archive
in
self
.
archivefiles
:
im_data
=
archive
[
0
]
.
read
(
archive
[
1
])
im_data
=
archive
[
0
]
.
read
(
archive
[
1
])
im_data
=
np
.
asarray
(
bytearray
(
im_data
),
dtype
=
'uint8'
)
yield
[
im_data
]
yield
[
im_data
]
...
@@ -47,7 +48,7 @@ class ImageEncode(MapDataComponent):
...
@@ -47,7 +48,7 @@ class ImageEncode(MapDataComponent):
class
ImageDecode
(
MapDataComponent
):
class
ImageDecode
(
MapDataComponent
):
def
__init__
(
self
,
ds
,
mode
=
'.jpg'
,
index
=
0
):
def
__init__
(
self
,
ds
,
index
=
0
):
def
func
(
im_data
):
def
func
(
im_data
):
img
=
cv2
.
imdecode
(
im_data
,
cv2
.
IMREAD_COLOR
)
img
=
cv2
.
imdecode
(
im_data
,
cv2
.
IMREAD_COLOR
)
return
img
return
img
...
...
examples/load-vgg16.py
View file @
05494dd6
...
@@ -83,9 +83,7 @@ def run_test(path, input):
...
@@ -83,9 +83,7 @@ def run_test(path, input):
# VGG16 requires channelwise mean substraction
# VGG16 requires channelwise mean substraction
VGG_MEAN
=
[
103.939
,
116.779
,
123.68
]
VGG_MEAN
=
[
103.939
,
116.779
,
123.68
]
im
[:,
:,
:,
0
]
-=
VGG_MEAN
[
2
]
im
-=
VGG_MEAN
[::
-
1
]
im
[:,
:,
:,
1
]
-=
VGG_MEAN
[
1
]
im
[:,
:,
:,
2
]
-=
VGG_MEAN
[
0
]
outputs
=
predict_func
(
im
)[
0
]
outputs
=
predict_func
(
im
)[
0
]
prob
=
outputs
[
0
]
prob
=
outputs
[
0
]
...
...
examples/load-vgg19.py
View file @
05494dd6
...
@@ -79,9 +79,7 @@ def run_test(path, input):
...
@@ -79,9 +79,7 @@ def run_test(path, input):
# VGG19 requires channelwise mean substraction
# VGG19 requires channelwise mean substraction
VGG_MEAN
=
[
103.939
,
116.779
,
123.68
]
VGG_MEAN
=
[
103.939
,
116.779
,
123.68
]
im
[:,
:,
:,
0
]
-=
VGG_MEAN
[
2
]
im
-=
VGG_MEAN
[::
-
1
]
im
[:,
:,
:,
1
]
-=
VGG_MEAN
[
1
]
im
[:,
:,
:,
2
]
-=
VGG_MEAN
[
0
]
outputs
=
predict_func
(
im
)[
0
]
outputs
=
predict_func
(
im
)[
0
]
prob
=
outputs
[
0
]
prob
=
outputs
[
0
]
ret
=
prob
.
argsort
()[
-
10
:][::
-
1
]
ret
=
prob
.
argsort
()[
-
10
:][::
-
1
]
...
...
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