MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / __call__

Method __call__

utils/general_util.py:532–545  ·  view source on GitHub ↗
(self, tensor)

Source from the content-addressed store, hash-verified

530 self.crop_size = crop_size
531
532 def __call__(self, tensor):
533 _, h, w = tensor.shape
534
535 top_ratio = random.uniform(0.2,self.top_ratio)
536 left_ratio = random.uniform(0.3,0.7)
537
538 crop_size = random.randint(self.crop_size,h)
539
540 top = int((h-crop_size) * top_ratio)
541 left = int((w-crop_size) * left_ratio)
542
543 tensor_cropped = F.crop(tensor, top, left, self.crop_size, self.crop_size)
544
545 return tensor_cropped
546
547class HorizontalFlip(object):
548 def __call__(self, img):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected