Update utils.py
Browse files
utils.py
CHANGED
|
@@ -8,10 +8,9 @@ def RGB2gray(rgb):
|
|
| 8 |
gray = 0.2989 * r + 0.5870 * g + 0.1140 * b
|
| 9 |
return gray
|
| 10 |
|
| 11 |
-
# Update img_to_patches to handle direct image input
|
| 12 |
def img_to_patches(img: PIL.Image.Image) -> tuple:
|
| 13 |
patch_size = 16
|
| 14 |
-
img = img.convert('RGB')
|
| 15 |
|
| 16 |
grayscale_imgs = []
|
| 17 |
imgs = []
|
|
|
|
| 8 |
gray = 0.2989 * r + 0.5870 * g + 0.1140 * b
|
| 9 |
return gray
|
| 10 |
|
|
|
|
| 11 |
def img_to_patches(img: PIL.Image.Image) -> tuple:
|
| 12 |
patch_size = 16
|
| 13 |
+
img = img.convert('RGB')
|
| 14 |
|
| 15 |
grayscale_imgs = []
|
| 16 |
imgs = []
|