pytorch-video-recognition
pytorch-video-recognition copied to clipboard
A question aboue the function "randomflip(self, buffer)"
trafficstars
https://github.com/jfzhang95/pytorch-video-recognition/blob/master/dataloaders/dataset.py#L198
def randomflip(self, buffer):
"""Horizontally flip the given image and ground truth randomly with a probability of 0.5."""
if np.random.random() < 0.5:
for i, frame in enumerate(buffer):
frame = cv2.flip(buffer[i], flipCode=1)
buffer[i] = cv2.flip(frame, flipCode=1)
return buffer
Flip the frame horizontally first, but flip the frame horizontally again in the buffer[i]. Wouldn't that have no effect?