MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / pad

Function pad

tutorials/motr/transforms.py:295–305  ·  view source on GitHub ↗
(image, target, padding)

Source from the content-addressed store, hash-verified

293
294
295def pad(image, target, padding):
296 # assumes that we only pad on the bottom right corners
297 padded_image = F.pad(image, (0, 0, padding[0], padding[1]))
298 if target is None:
299 return padded_image, None
300 target = target.copy()
301 # should we do something wrt the original size?
302 target["size"] = torch.tensor(padded_image[::-1])
303 if "masks" in target:
304 target['masks'] = torch.nn.functional.pad(target['masks'], (0, padding[0], 0, padding[1]))
305 return padded_image, target
306
307
308class RandomCrop(object):

Callers 2

__call__Method · 0.85
__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected