Sense-X / UniFormer

[ICLR2022] official implementation of UniFormer
Apache License 2.0
823 stars 111 forks source link

some ambiguousness when testing on k400 #126

Closed LMMMEng closed 10 months ago

LMMMEng commented 10 months ago

Hi, when I tested uniformer_s8x8_k400 on the k400 using the provided test script, I encountered the following Error:

File "UniFormer/video_classification/slowfast/datasets/utils.py", line 179, in spatial_sampling
    assert len({min_scale, max_scale, crop_size}) == 1
AssertionError

Upon printing the variables, I observed: {min_scale, max_scale, crop_size} == {256, 256, 224}, indicating that len({min_scale, max_scale, crop_size}) == 2>1.

The function spatial_sampling() is utilized in slowfast/datasets/kinetics.py. When the model is set to test, the following code activates:

            min_scale, max_scale, crop_size = (
                [self.cfg.DATA.TEST_CROP_SIZE] * 3
                if self.cfg.TEST.NUM_SPATIAL_CROPS > 1
                else [self.cfg.DATA.TRAIN_JITTER_SCALES[0]] * 2
                + [self.cfg.DATA.TEST_CROP_SIZE]
            )

However, in your test script exp/uniformer_s8x8_k400/test.sh, TEST.NUM_SPATIAL_CROPS is 1. Consequently, min_scale, max_scale, crop_size == [self.cfg.DATA.TRAIN_JITTER_SCALES[0]] * 2 + [self.cfg.DATA.TEST_CROP_SIZE], resulting in len({min_scale, max_scale, crop_size}) == 2, since TRAIN_JITTER_SCALES[0] is 256 according to exp/uniformer_s8x8_k400/test.yaml . This leads to the aforementioned error.

To resolve this issue, it seems that increasing the TEST_CROP_SIZE to 256 or setting NUM_SPATIAL_CROPS to a value greater than 1 might provide a solution. Could you please let me know what should I do?

LMMMEng commented 10 months ago

TRAIN_JITTER_SCALES is modified to [224, 224], the result is consistent with that provided by the author.