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

Is random flip accomplished only in testing set?

Open wave-transmitter opened this issue 6 years ago • 2 comments

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'?

wave-transmitter avatar Feb 05 '19 09:02 wave-transmitter

@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

leftthomas avatar Apr 05 '19 13:04 leftthomas

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

Taylor-X76 avatar May 24 '21 07:05 Taylor-X76