MCPcopy Create free account
hub / github.com/VCIP-RGBD/DFormer / get_2dshape

Function get_2dshape

utils/transforms.py:12–25  ·  view source on GitHub ↗
(shape, *, zero=True)

Source from the content-addressed store, hash-verified

10
11
12def get_2dshape(shape, *, zero=True):
13 if not isinstance(shape, collections.abc.Iterable):
14 shape = int(shape)
15 shape = (shape, shape)
16 else:
17 h, w = map(int, shape)
18 shape = (h, w)
19 if zero:
20 minv = 0
21 else:
22 minv = 1
23
24 assert min(shape) >= minv, "invalid shape: {}".format(shape)
25 return shape
26
27
28def random_crop_pad_to_shape(img, crop_pos, crop_size, pad_label_value):

Callers 3

random_crop_pad_to_shapeFunction · 0.85
generate_random_crop_posFunction · 0.85
pad_image_to_shapeFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected