Skip to content

Commit ae58e40

Browse files
committed
a
1 parent 114bae4 commit ae58e40

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mmseg/datasets/pipelines/hubmap_transforms.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,29 @@ def __call__(self, results):
6868

6969
return results
7070

71+
72+
@PIPELINES.register_module()
73+
class HubmapTestTransform:
74+
75+
def __call__(self, results):
76+
img = results['img']
77+
keys = []
78+
masks = []
79+
for key in results.get('seg_fields', []):
80+
keys.append(key)
81+
masks.append(results[key])
82+
83+
img = np.float32(img) if img.dtype != np.float32 else img.copy()
84+
assert img.dtype != np.uint8
85+
#if to_rgb:
86+
cv2.cvtColor(img, cv2.COLOR_BGR2RGB, img) # inplace
87+
88+
results['img'] = img
89+
for key, mask in zip(keys, masks):
90+
results[key] = mask
91+
92+
return results
93+
7194
#from albumentations.pytorch import ToTensor
7295
#from get_config import get_config
7396

0 commit comments

Comments
 (0)