pytorch-video-recognition icon indicating copy to clipboard operation
pytorch-video-recognition copied to clipboard

A question aboue the function "randomflip(self, buffer)"

Open YuQi9797 opened this issue 4 years ago • 0 comments
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?

YuQi9797 avatar Oct 25 '21 14:10 YuQi9797