jfzhang95 / pytorch-video-recognition

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

Is random flip accomplished only in testing set? #15

Open wave-transmitter opened 5 years ago

wave-transmitter commented 5 years ago

According to following lines of code from dataset.py, it seems like random flip is triggered only for testing data. https://github.com/jfzhang95/pytorch-video-recognition/blob/a63b85f351be193159eaad011115973bb99b9745/dataloaders/dataset.py#L81-L83

Do I get it wrong, or this is a bug where 'test' should be changed by 'train'?

leftthomas commented 5 years ago

@wave-transmitter It seems like a typo error, it should be on training process. And I think the function randomflip has a bug, in the for loop, it calls cv2.flip two times, it should call only once.

    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
Taylor-X76 commented 3 years ago

II think so too After two cv2.flip(...), the picture has no change.