Showing
1 changed file
with
14 additions
and
3 deletions
| ... | @@ -13,7 +13,7 @@ class BaseTransform(ABC): | ... | @@ -13,7 +13,7 @@ class BaseTransform(ABC): |
| 13 | self.mag = mag | 13 | self.mag = mag |
| 14 | 14 | ||
| 15 | def __call__(self, img): | 15 | def __call__(self, img): |
| 16 | - return transforms.RandomApply([self.transform], self.prob)(img) | 16 | + return transforms.RandomApply([self.transform], self.prob)(img) ## |
| 17 | 17 | ||
| 18 | def __repr__(self): | 18 | def __repr__(self): |
| 19 | return '%s(prob=%.2f, magnitude=%.2f)' % \ | 19 | return '%s(prob=%.2f, magnitude=%.2f)' % \ |
| ... | @@ -154,8 +154,19 @@ class CutoutOp(object): | ... | @@ -154,8 +154,19 @@ class CutoutOp(object): |
| 154 | 154 | ||
| 155 | mask[y1: y2, x1: x2, :] = 0. | 155 | mask[y1: y2, x1: x2, :] = 0. |
| 156 | 156 | ||
| 157 | - img = mask*np.asarray(img).astype(np.uint8) | 157 | + # img = mask*np.asarray(img).astype(np.uint8) |
| 158 | - img = Image.fromarray(mask*np.asarray(img)) | 158 | + # print("\nmask max:\n", np.amax(mask), mask.shape) #(32, 32, 1) |
| 159 | + # print("\nnp.asarray(img) max: \n", np.amax(np.asarray(img)), np.asarray(img).shape) #(32, 32, 32) | ||
| 160 | + # img = Image.fromarray(mask*np.asarray(img)) #(32, 32, 32) | ||
| 159 | 161 | ||
| 162 | + mask = np.reshape(mask, (32,32)) | ||
| 163 | + | ||
| 164 | + #print("\n(img) max: \n", np.amax(np.asarray(img)), np.asarray(img).shape) #[0, 255] (32, 32) | ||
| 165 | + # print("\nmask: ", mask.shape) #(32, 32) | ||
| 166 | + # print("\img: ", np.asarray(img).shape) #(32, 32) | ||
| 167 | + # print("mask*img:\n", (mask*np.asarray(img).astype(np.uint8)).shape) | ||
| 168 | + #ㄴ[0, 255], (32, 32) | ||
| 169 | + img = Image.fromarray(mask*np.asarray(img).astype(np.uint8)) # | ||
| 170 | + | ||
| 160 | return img | 171 | return img |
| 161 | 172 | ... | ... |
-
Please register or login to post a comment