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
c4897600
Commit
c4897600
authored
Nov 17, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap aleju/imgaug (#399)
parent
e027bc2a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
3 deletions
+72
-3
README.md
README.md
+1
-1
docs/conf.py
docs/conf.py
+15
-1
docs/modules/dataflow.imgaug.rst
docs/modules/dataflow.imgaug.rst
+4
-0
docs/tutorial/index.rst
docs/tutorial/index.rst
+0
-1
tensorpack/dataflow/imgaug/external.py
tensorpack/dataflow/imgaug/external.py
+52
-0
No files found.
README.md
View file @
c4897600
...
@@ -30,7 +30,7 @@ It's Yet Another TF high-level API, with __speed__, __readability__ and __flexib
...
@@ -30,7 +30,7 @@ It's Yet Another TF high-level API, with __speed__, __readability__ and __flexib
+
There are too many symbolic function wrappers in the world. Tensorpack includes only a few common models.
+
There are too many symbolic function wrappers in the world. Tensorpack includes only a few common models.
But you can use any symbolic function library inside Tensorpack, including tf.layers/Keras/slim/tflearn/tensorlayer/....
But you can use any symbolic function library inside Tensorpack, including tf.layers/Keras/slim/tflearn/tensorlayer/....
See
[
tutorials
](
http://tensorpack.readthedocs.io/tutorial/index.html#user-tutorials
)
to know more about these features.
See
[
tutorials
and documentations
](
http://tensorpack.readthedocs.io/tutorial/index.html#user-tutorials
)
to know more about these features.
## [Examples](examples):
## [Examples](examples):
...
...
docs/conf.py
View file @
c4897600
...
@@ -30,7 +30,21 @@ MOCK_MODULES = ['tabulate', 'h5py',
...
@@ -30,7 +30,21 @@ MOCK_MODULES = ['tabulate', 'h5py',
'scipy'
,
'scipy.misc'
,
'scipy.io'
,
'scipy'
,
'scipy.misc'
,
'scipy.io'
,
'tornado'
,
'tornado.concurrent'
,
'tornado'
,
'tornado.concurrent'
,
'horovod'
,
'horovod.tensorflow'
,
'horovod'
,
'horovod.tensorflow'
,
'subprocess32'
,
'functools32'
]
'subprocess32'
,
'functools32'
,
'imgaug'
]
# it's better to have tensorflow installed (for some docs to show)
# but it's OK to mock it as well
try
:
import
tensorflow
except
ImportError
:
mod
=
sys
.
modules
[
'tensorflow'
]
=
mock
.
Mock
(
name
=
'tensorflow'
)
mod
.
__version__
=
mod
.
VERSION
=
'1.12'
MOCK_MODULES
.
extend
([
'tensorflow.python.training.monitored_session'
])
MOCK_MODULES
.
extend
([
'tensorflow.python.training'
])
MOCK_MODULES
.
extend
([
'tensorflow.python.client'
])
MOCK_MODULES
.
extend
([
'tensorflow.contrib.graph_editor'
])
for
mod_name
in
MOCK_MODULES
:
for
mod_name
in
MOCK_MODULES
:
sys
.
modules
[
mod_name
]
=
mock
.
Mock
(
name
=
mod_name
)
sys
.
modules
[
mod_name
]
=
mock
.
Mock
(
name
=
mod_name
)
sys
.
modules
[
'cv2'
]
.
__version__
=
'3.2.1'
# fake version
sys
.
modules
[
'cv2'
]
.
__version__
=
'3.2.1'
# fake version
...
...
docs/modules/dataflow.imgaug.rst
View file @
c4897600
tensorpack.dataflow.imgaug package
tensorpack.dataflow.imgaug package
==================================
==================================
This package contains Tensorpack's augmentors.
Note that other image augmentation libraries can be wrapped into Tensorpack's interface as well.
For example, see `imgaug.IAAugmentor <#tensorpack.dataflow.imgaug.IAAugmentor>`_.
.. container:: custom-index
.. container:: custom-index
.. raw:: html
.. raw:: html
...
...
docs/tutorial/index.rst
View file @
c4897600
...
@@ -22,7 +22,6 @@ User Tutorials
...
@@ -22,7 +22,6 @@ User Tutorials
save-load
save-load
summary
summary
inference
inference
export
faq
faq
...
...
tensorpack/dataflow/imgaug/external.py
0 → 100644
View file @
c4897600
#!/usr/bin/env python
import
numpy
as
np
from
.base
import
ImageAugmentor
__all__
=
[
'IAAugmentor'
]
class
IAAugmentor
(
ImageAugmentor
):
"""
Wrap an augmentor form the IAA library: https://github.com/aleju/imgaug
Both images and coordinates are supported.
Note:
1. It's NOT RECOMMENDED
to use coordinates because the IAA library does not handle coordinates accurately.
2. Only uint8 images are supported by the IAA library.
3. The IAA library can only produces images of the same shape.
"""
def
__init__
(
self
,
augmentor
):
"""
Args:
augmentor (iaa.Augmenter):
"""
super
(
IAAugmentor
,
self
)
.
__init__
()
self
.
_aug
=
augmentor
def
_get_augment_params
(
self
,
img
):
return
(
self
.
_aug
.
to_deterministic
(),
img
.
shape
)
def
_augment
(
self
,
img
,
p
):
aug
,
_
=
p
return
aug
.
augment_image
(
img
)
def
_augment_coords
(
self
,
coords
,
p
):
aug
,
shape
=
p
points
=
[
IA
.
Keypoint
(
x
=
x
,
y
=
y
)
for
x
,
y
in
coords
]
points
=
IA
.
KeypointsOnImage
(
points
,
shape
=
shape
)
augmented
=
aug
.
augment_keypoints
([
points
])[
0
]
.
keypoints
return
np
.
asarray
([[
p
.
x
,
p
.
y
]
for
p
in
augmented
])
from
...utils.develop
import
create_dummy_class
# noqa
try
:
import
imgaug
as
IA
except
ImportError
:
IAAugmentor
=
create_dummy_class
(
'IAAugmentor'
,
'imgaug'
)
# noqa
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