Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.learn.tensorflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.learn.tensorflow
Commits
54a80323
Commit
54a80323
authored
Feb 07, 2020
by
Amir MOHAMMADI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a function to load png images
parent
70e0b851
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
bob/learn/tensorflow/dataset/image.py
bob/learn/tensorflow/dataset/image.py
+22
-0
No files found.
bob/learn/tensorflow/dataset/image.py
View file @
54a80323
...
...
@@ -197,3 +197,25 @@ def image_augmentation_parser(filename,
features
[
'key'
]
=
filename
return
features
,
label
def
load_pngs
(
img_path
,
img_shape
):
"""Read png files using tensorflow API
You must know the shape of the image beforehand to use this function.
Parameters
----------
img_path : str
Path to the image
img_shape : list
A list or tuple that contains image's shape in channels_last format
Returns
-------
object
The loaded png file
"""
img_raw
=
tf
.
read_file
(
img_path
)
img_tensor
=
tf
.
image
.
decode_png
(
img_raw
,
channels
=
img_shape
[
-
1
])
img_final
=
tf
.
reshape
(
img_tensor
,
img_shape
)
return
img_final
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