Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions basicsr/data/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ def augment(imgs, hflip=True, rotation=True, flows=None, return_status=False):

def _augment(img):
if hflip: # horizontal
cv2.flip(img, 1, img)
img = cv2.flip(img, 1) # Using inplace operations may cause memory leak
if vflip: # vertical
cv2.flip(img, 0, img)
img = cv2.flip(img, 0)
if rot90:
img = img.transpose(1, 0, 2)
return img

def _augment_flow(flow):
if hflip: # horizontal
cv2.flip(flow, 1, flow)
flow = cv2.flip(flow, 1)
flow[:, :, 0] *= -1
if vflip: # vertical
cv2.flip(flow, 0, flow)
flow = cv2.flip(flow, 0)
flow[:, :, 1] *= -1
if rot90:
flow = flow.transpose(1, 0, 2)
Expand Down