Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design2
/
2016104167
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
조현아
2020-04-04 16:23:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c038aea4ba9a6312bc5994d623979df27bdfd9e9
c038aea4
1 parent
43a584e5
resolved PIL image error
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
code/FAA2/transforms.py
code/FAA2/transforms.py
View file @
c038aea
...
...
@@ -13,7 +13,7 @@ class BaseTransform(ABC):
self
.
mag
=
mag
def
__call__
(
self
,
img
):
return
transforms
.
RandomApply
([
self
.
transform
],
self
.
prob
)(
img
)
return
transforms
.
RandomApply
([
self
.
transform
],
self
.
prob
)(
img
)
##
def
__repr__
(
self
):
return
'
%
s(prob=
%.2
f, magnitude=
%.2
f)'
%
\
...
...
@@ -154,8 +154,19 @@ class CutoutOp(object):
mask
[
y1
:
y2
,
x1
:
x2
,
:]
=
0.
img
=
mask
*
np
.
asarray
(
img
)
.
astype
(
np
.
uint8
)
img
=
Image
.
fromarray
(
mask
*
np
.
asarray
(
img
))
# img = mask*np.asarray(img).astype(np.uint8)
# print("\nmask max:\n", np.amax(mask), mask.shape) #(32, 32, 1)
# print("\nnp.asarray(img) max: \n", np.amax(np.asarray(img)), np.asarray(img).shape) #(32, 32, 32)
# img = Image.fromarray(mask*np.asarray(img)) #(32, 32, 32)
mask
=
np
.
reshape
(
mask
,
(
32
,
32
))
#print("\n(img) max: \n", np.amax(np.asarray(img)), np.asarray(img).shape) #[0, 255] (32, 32)
# print("\nmask: ", mask.shape) #(32, 32)
# print("\img: ", np.asarray(img).shape) #(32, 32)
# print("mask*img:\n", (mask*np.asarray(img).astype(np.uint8)).shape)
#ㄴ[0, 255], (32, 32)
img
=
Image
.
fromarray
(
mask
*
np
.
asarray
(
img
)
.
astype
(
np
.
uint8
))
#
return
img
...
...
Please
register
or
login
to post a comment