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

Function hflip

tutorials/motr/transforms.py:219–233  ·  view source on GitHub ↗
(image, target)

Source from the content-addressed store, hash-verified

217
218
219def hflip(image, target):
220 flipped_image = F.hflip(image)
221
222 w, h = image.size
223
224 target = target.copy()
225 if "boxes" in target:
226 boxes = target["boxes"]
227 boxes = boxes[:, [2, 1, 0, 3]] * torch.as_tensor([-1, 1, -1, 1]) + torch.as_tensor([w, 0, w, 0])
228 target["boxes"] = boxes
229
230 if "masks" in target:
231 target['masks'] = target['masks'].flip(-1)
232
233 return flipped_image, target
234
235
236def resize(image, target, size, max_size=None):

Callers 2

__call__Method · 0.85
__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected