laura-wang / video-pace

code for our ECCV-2020 paper: Self-supervised Video Representation Learning by Pace Prediction
98 stars 12 forks source link

Code verify #5

Closed jaypatravali closed 3 years ago

jaypatravali commented 3 years ago
def loop_load_rgb(self, video_dir, start_frame, sample_rate, clip_len,
                      num_frames):

        video_clip = []
        idx = 0

        for i in range(clip_len):
            cur_img_path = os.path.join(
                video_dir,
                "frame" + "{:06}.jpg".format(start_frame + idx * sample_rate))

            img = cv2.imread(cur_img_path)
            video_clip.append(img)

            if (start_frame + (idx + 1) * sample_rate) > num_frames:
                start_frame = 1 <--
                idx = 0
            else:
                idx += 1

why is the blank frames starting from the begining? should the start_frame be commented out?

jaypatravali commented 3 years ago

from the paper,

Start frame of each video clip is randomly generated and will loop over the video sample if the desired training clip is longer.than the original video sample.

Oh okay this answer my question.

BestJuly commented 3 years ago

I have the same question as you did. Even there is some descriptions here. In my intuition, I think this may cause some problems in training. And I am curious that whether it makes a difference when using some other sampling ways to instead.

jaypatravali commented 3 years ago

@BestJuly I ended up with NaNs after 4 epochs of training.

BestJuly commented 3 years ago

I do not have the same problem. Here is my logs:

[Epoch1/3178] Loss:   1.4752 Acc: 0.2333 Time 0.3074
[Epoch2/3178] Loss: 1.2507 Acc: 0.4000   Time 0.3041
[Epoch3/3178] Loss: 1.3052 Acc: 0.3000   Time 0.3037
[Epoch4/3178] Loss: 1.2141 Acc: 0.3667   Time 0.3039
[Epoch5/3178] Loss: 1.3436 Acc: 0.2333   Time 0.3041
[Epoch6/3178] Loss: 1.0533 Acc: 0.6000   Time 0.3044
[Epoch7/3178] Loss: 1.1387 Acc: 0.4333   Time 0.3057
[Epoch8/3178] Loss: 1.1614 Acc: 0.4667   Time 0.3002
[Epoch9/3178] Loss: 1.1103 Acc: 0.3667   Time 0.3032
[Epoch10/3178] Loss: 1.1639 Acc: 0.3667   Time 0.3034
[Epoch11/3178] Loss: 1.0448 Acc: 0.5667   Time 0.3037
[Epoch12/3178] Loss: 1.1925 Acc: 0.3333   Time 0.3040
[Epoch13/3178] Loss: 1.0283 Acc: 0.5333   Time 0.3041
[Epoch14/3178] Loss: 0.9437 Acc: 0.6000   Time 0.2997
[Epoch15/3178] Loss: 0.9926 Acc: 0.5000   Time 0.2996
[Epoch16/3178] Loss: 1.0129 Acc: 0.5000   Time 0.3039
[Epoch17/3178] Loss: 1.3208 Acc: 0.3667   Time 0.3015
[Epoch18/3178] Loss: 1.0250 Acc: 0.4667   Time 0.3018

There are three things I want to mention:

  1. The random seed is not fixed;
  2. The reported loss/accuracy is not an average of the corresponding epoch, just the results for the last iteration;
  3. The used data is pre-computed, downloaded from here.
loovi7 commented 3 years ago

I do not have the same problem. Here is my logs:

[Epoch1/3178] Loss:   1.4752 Acc: 0.2333 Time 0.3074
[Epoch2/3178] Loss: 1.2507 Acc: 0.4000   Time 0.3041
[Epoch3/3178] Loss: 1.3052 Acc: 0.3000   Time 0.3037
[Epoch4/3178] Loss: 1.2141 Acc: 0.3667   Time 0.3039
[Epoch5/3178] Loss: 1.3436 Acc: 0.2333   Time 0.3041
[Epoch6/3178] Loss: 1.0533 Acc: 0.6000   Time 0.3044
[Epoch7/3178] Loss: 1.1387 Acc: 0.4333   Time 0.3057
[Epoch8/3178] Loss: 1.1614 Acc: 0.4667   Time 0.3002
[Epoch9/3178] Loss: 1.1103 Acc: 0.3667   Time 0.3032
[Epoch10/3178] Loss: 1.1639 Acc: 0.3667   Time 0.3034
[Epoch11/3178] Loss: 1.0448 Acc: 0.5667   Time 0.3037
[Epoch12/3178] Loss: 1.1925 Acc: 0.3333   Time 0.3040
[Epoch13/3178] Loss: 1.0283 Acc: 0.5333   Time 0.3041
[Epoch14/3178] Loss: 0.9437 Acc: 0.6000   Time 0.2997
[Epoch15/3178] Loss: 0.9926 Acc: 0.5000   Time 0.2996
[Epoch16/3178] Loss: 1.0129 Acc: 0.5000   Time 0.3039
[Epoch17/3178] Loss: 1.3208 Acc: 0.3667   Time 0.3015
[Epoch18/3178] Loss: 1.0250 Acc: 0.4667   Time 0.3018

There are three things I want to mention:

  1. The random seed is not fixed;
  2. The reported loss/accuracy is not an average of the corresponding epoch, just the results for the last iteration;
  3. The used data is pre-computed, downloaded from here.

hello! Could you tell me how to arrange the training data? I have download the data like this: image but i don't know how to process them to run train.py? Please help me.