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
67cfcdee
You need to sign in or sign up before continuing.
Commit
67cfcdee
authored
May 10, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix augmentor bug
parent
fb217486
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
6 deletions
+9
-6
tensorpack/dataflow/imgaug/base.py
tensorpack/dataflow/imgaug/base.py
+3
-0
tensorpack/dataflow/imgaug/deform.py
tensorpack/dataflow/imgaug/deform.py
+0
-1
tensorpack/dataflow/imgaug/noname.py
tensorpack/dataflow/imgaug/noname.py
+3
-3
tensorpack/dataflow/imgaug/paste.py
tensorpack/dataflow/imgaug/paste.py
+3
-2
No files found.
tensorpack/dataflow/imgaug/base.py
View file @
67cfcdee
...
@@ -77,6 +77,9 @@ class AugmentorList(ImageAugmentor):
...
@@ -77,6 +77,9 @@ class AugmentorList(ImageAugmentor):
raise
RuntimeError
(
"Cannot simply get parameters of a AugmentorList!"
)
raise
RuntimeError
(
"Cannot simply get parameters of a AugmentorList!"
)
def
_augment_return_params
(
self
,
img
):
def
_augment_return_params
(
self
,
img
):
assert
img
.
ndim
in
[
2
,
3
],
img
.
ndim
img
=
img
.
astype
(
'float32'
)
prms
=
[]
prms
=
[]
for
a
in
self
.
augs
:
for
a
in
self
.
augs
:
img
,
prm
=
a
.
_augment_return_params
(
img
)
img
,
prm
=
a
.
_augment_return_params
(
img
)
...
...
tensorpack/dataflow/imgaug/deform.py
View file @
67cfcdee
...
@@ -88,7 +88,6 @@ class GaussianDeform(ImageAugmentor):
...
@@ -88,7 +88,6 @@ class GaussianDeform(ImageAugmentor):
def
_augment
(
self
,
img
,
v
):
def
_augment
(
self
,
img
,
v
):
grid
=
self
.
grid
+
np
.
dot
(
self
.
gws
,
v
)
grid
=
self
.
grid
+
np
.
dot
(
self
.
gws
,
v
)
print
(
grid
)
return
np_sample
(
img
,
grid
)
return
np_sample
(
img
,
grid
)
def
_fprop_coord
(
self
,
coord
,
param
):
def
_fprop_coord
(
self
,
coord
,
param
):
...
...
tensorpack/dataflow/imgaug/noname.py
View file @
67cfcdee
...
@@ -54,7 +54,7 @@ class MapImage(ImageAugmentor):
...
@@ -54,7 +54,7 @@ class MapImage(ImageAugmentor):
self
.
func
=
func
self
.
func
=
func
def
_augment
(
self
,
img
,
_
):
def
_augment
(
self
,
img
,
_
):
img
=
self
.
func
(
img
)
return
self
.
func
(
img
)
class
Resize
(
ImageAugmentor
):
class
Resize
(
ImageAugmentor
):
...
@@ -66,6 +66,6 @@ class Resize(ImageAugmentor):
...
@@ -66,6 +66,6 @@ class Resize(ImageAugmentor):
self
.
_init
(
locals
())
self
.
_init
(
locals
())
def
_augment
(
self
,
img
,
_
):
def
_augment
(
self
,
img
,
_
):
img
.
arr
=
cv2
.
resize
(
return
cv2
.
resize
(
img
.
arr
,
self
.
shape
[::
-
1
],
img
,
self
.
shape
[::
-
1
],
interpolation
=
cv2
.
INTER_CUBIC
)
interpolation
=
cv2
.
INTER_CUBIC
)
tensorpack/dataflow/imgaug/paste.py
View file @
67cfcdee
...
@@ -67,7 +67,8 @@ class CenterPaste(ImageAugmentor):
...
@@ -67,7 +67,8 @@ class CenterPaste(ImageAugmentor):
w0
=
int
((
self
.
background_shape
[
1
]
-
img_shape
[
1
])
*
0.5
)
w0
=
int
((
self
.
background_shape
[
1
]
-
img_shape
[
1
])
*
0.5
)
background
[
h0
:
h0
+
img_shape
[
0
],
w0
:
w0
+
img_shape
[
1
]]
=
img
background
[
h0
:
h0
+
img_shape
[
0
],
w0
:
w0
+
img_shape
[
1
]]
=
img
img
=
background
img
=
background
if
img
.
coords
:
return
img
raise
NotImplementedError
()
def
_fprop_coord
(
self
,
coord
,
param
):
raise
NotImplementedError
()
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