MCPcopy Create free account
hub / github.com/CSAILVision/gandissect / ScaleSegmentation

Class ScaleSegmentation

netdissect/broden.py:207–217  ·  view source on GitHub ↗

Utility for scaling segmentations, using nearest-neighbor zooming.

Source from the content-addressed store, hash-verified

205 return result
206
207class ScaleSegmentation:
208 '''
209 Utility for scaling segmentations, using nearest-neighbor zooming.
210 '''
211 def __init__(self, target_height, target_width):
212 self.target_height = target_height
213 self.target_width = target_width
214 def __call__(self, seg):
215 ratio = (1, self.target_height / float(seg.shape[1]),
216 self.target_width / float(seg.shape[2]))
217 return ndimage.zoom(seg, ratio, order=0)
218
219def scatter_batch(seg, num_labels, omit_zero=True, dtype=torch.uint8):
220 '''

Callers 1

test_broden_datasetFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_broden_datasetFunction · 0.68