Utility for scaling segmentations, using nearest-neighbor zooming.
| 205 | return result |
| 206 | |
| 207 | class 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 | |
| 219 | def scatter_batch(seg, num_labels, omit_zero=True, dtype=torch.uint8): |
| 220 | ''' |
no outgoing calls