jfzhang95 / pytorch-video-recognition

PyTorch implemented C3D, R3D, R2Plus1D models for video activity recognition.
MIT License
1.16k stars 250 forks source link

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

Open YuQi9797 opened 2 years ago

YuQi9797 commented 2 years ago

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?