Upload processor
Browse files
image_processing_basnet.py
CHANGED
|
@@ -17,7 +17,7 @@ class RescaleT(object):
|
|
| 17 |
assert isinstance(output_size, (int, tuple))
|
| 18 |
self.output_size = output_size
|
| 19 |
|
| 20 |
-
def __call__(self, sample):
|
| 21 |
image, label = sample["image"], sample["label"]
|
| 22 |
|
| 23 |
h, w = image.shape[:2]
|
|
@@ -61,7 +61,7 @@ class RescaleT(object):
|
|
| 61 |
class ToTensorLab(object):
|
| 62 |
"""Convert ndarrays in sample to Tensors."""
|
| 63 |
|
| 64 |
-
def __init__(self, flag=0):
|
| 65 |
self.flag = flag
|
| 66 |
|
| 67 |
def __call__(self, sample):
|
|
@@ -74,7 +74,6 @@ class ToTensorLab(object):
|
|
| 74 |
else:
|
| 75 |
label = label / np.max(label)
|
| 76 |
|
| 77 |
-
# print('self.flag:', self.flag) # Default: 0
|
| 78 |
# change the color space
|
| 79 |
if self.flag == 2: # with rgb and Lab colors
|
| 80 |
tmpImg = np.zeros((image.shape[0], image.shape[1], 6))
|
|
|
|
| 17 |
assert isinstance(output_size, (int, tuple))
|
| 18 |
self.output_size = output_size
|
| 19 |
|
| 20 |
+
def __call__(self, sample) -> Dict[str, np.ndarray]:
|
| 21 |
image, label = sample["image"], sample["label"]
|
| 22 |
|
| 23 |
h, w = image.shape[:2]
|
|
|
|
| 61 |
class ToTensorLab(object):
|
| 62 |
"""Convert ndarrays in sample to Tensors."""
|
| 63 |
|
| 64 |
+
def __init__(self, flag: int = 0) -> None:
|
| 65 |
self.flag = flag
|
| 66 |
|
| 67 |
def __call__(self, sample):
|
|
|
|
| 74 |
else:
|
| 75 |
label = label / np.max(label)
|
| 76 |
|
|
|
|
| 77 |
# change the color space
|
| 78 |
if self.flag == 2: # with rgb and Lab colors
|
| 79 |
tmpImg = np.zeros((image.shape[0], image.shape[1], 6))
|