pseudo-3d-pytorch icon indicating copy to clipboard operation
pseudo-3d-pytorch copied to clipboard

About the accuracy

Open bbp94 opened this issue 6 years ago • 11 comments

Hi,I used your code to train the P3D199 on UCF101,with the pretrained weight you supported. My experiment top-1 result is 81%, which is far from the paper 93%, could you support the details about your training? Mine: Batch size:32 Learning rate: 0.001, divided by 10 each 10 epoch training data transformation:RandomResizeCrop(160), RandomHorizontalFlip(0.5), Totensor(), Normalize() val data transformation: Resize(182,242), CenterCrop(160), Totensor(), Normalize() Looking forward to your reply

bbp94 avatar Jan 15 '19 08:01 bbp94

Hi~ I have the same issue. On training set, the accuracy is 89@Top1, 98@Top5. But on test set, it is 42@Top1, 68@Top5.

The parameters: BS: 64 (on 4 GTX1080) LR: 0.05, decay by 0.1 every 40 epoch Training: Resize(182,242)-> RandomCrop(160)->RandomHorizontalFlip(0.5)->ToTensor() Test: Resize(182,242)-> CenterCrop(160)->ToTensor(). The final result is the average of 20 clips of each video.

I have debug for weeks.... Can you help me?

The full code/parameter/instruction are located in this repo: https://github.com/jinyu121/video_experiment

jinyu121 avatar Jan 22 '19 12:01 jinyu121

hi,@jinyu121 , maybe you can have a try with my parameters, especially the base LR and Droupout( 0.8). Besides, i think the test data augmentation should not do RandomHorizontalFlip.

bbp94 avatar Jan 25 '19 08:01 bbp94

Hi, @bbp94 , could you share your parameters about slow_rate, lr_mult and decay_mult in p3d_model.py? Thanks~

jinyu121 avatar Feb 13 '19 08:02 jinyu121

UPDATE: With pre-trained model, I can get 89.8@Top1, 98.26@Top5. But I can not get such result from scratch. Can anyone share your parameters? THX.

jinyu121 avatar Feb 19 '19 11:02 jinyu121

@jinyu121 Some of my parameters: self.optimizer = optim.SGD(params=params, lr=0.001, momentum=0.9, weight_decay=0.0001) self.scheduler = torch.optim.lr_scheduler.StepLR(self.optimizer, step_size=20, gamma=0.1) and I train the model with pre_trained weight. On training set, I got 90@Top1. On test set, got 81@Top1.

UPDATE: With pre-trained model, I can get 89.8@Top1, 98.26@Top5. But I can not get such result from scratch. Can anyone share your parameters? THX.

Could you tell me whether your result 89.8@Top1 is on test set? If it was, could you please share your parameters?

bbp94 avatar Feb 25 '19 03:02 bbp94

{
  "net": {
    "name": "p3d",
    "input_size": 160
  },
  "data": {
    "train": {
      "annotation": "data/ucf101-train.json", // Which is converted from trainlist01.txt by my video2frame tool
      "dataset": "data/ucf101-train",
      "n_frames": 16,
      "n_clips": 1,
      "flip": 0.5,
      "drop_last_iter": true
    },
    "val": {
      "annotation": "data/ucf101-test.json", // which is converted from test01.txt by the video2frame tool
      "dataset": "data/ucf101-test",
      "n_frames": 16,
      "n_clips": 20
    },
    "num_workers": 32
  },
  "train": {
    "pre_train": "data/p3d_rgb_199.checkpoint.pth.tar",
    "batch_size": 64,
    "epoch": 100,
    "learning_rate": 0.001,
    "decay": {
      "step": 40,
      "scale": 0.1
    },
    "momentum": 0.9,
    "weight_decay": 0.00001,
    "dropout": 0.5,
    "show_freq": 20
  },
  "val": {
    "batch_size": 1,
    "show_freq": 100,
    "val_freq": 10,
    "feature_mean": false // Which means we average the result after cls layer. If true, average the feature before the cls layer
  }
}

Under this setting, I got 89.8@Top1, 98.26@Top5 on testlist01.txt.

jinyu121 avatar Feb 25 '19 09:02 jinyu121

@jinyu121 Thank you for your help. But I can not achieve your result with your parameters, only got 82.7@Top1.
your data processing is still as follow?

Training: Resize(182,242)-> RandomCrop(160)->RandomHorizontalFlip(0.5)->ToTensor() Test: Resize(182,242)-> CenterCrop(160)->ToTensor().

The repo you have provided is invalid,could you please provide new one? or provide your training log?

bbp94 avatar Feb 27 '19 10:02 bbp94

Due to some personal code are added, I have to make it personal. Sorry for that.

The frames are resized into 182x242 using the video2frame tool.

        train_transform = transforms.Compose([
            NumpyToFloat(), # From 0-255 to 0-1
            NumpyRandomCrop(self.cfg.net.input_size), # 160x160
            NumpyRandomFlip(-2, self.cfg.data.train.flip),  # Random horizontal flip. -1 means vertical.
            NumpyImageNetNorm(), # in RGB order
            NumpyToTensor(is_copy=True)
        ])
        val_transform = transforms.Compose([
            NumpyToFloat(),
            NumpyCenterCrop(self.cfg.net.input_size),
            NumpyImageNetNorm(),
            NumpyToTensor(is_copy=True)
        ])

There are NO TRICKS in these transformers.

Log... Well, I didn't log them in files, just tensorboard record. If you use the pre-trained model, the P3D net will raise its accuracy quickly. It will get ~80%@Top1 in just 5 epochs.

Good luck!

jinyu121 avatar Feb 27 '19 13:02 jinyu121

Why you summoned me? :D

Man I was confused about the Email for quite a while. Until I got the part with the @top1

@jinyu121

top1 avatar Feb 27 '19 15:02 top1

@jinyu121 Sorry for disturb you again. I used the default slow_rate, lr_mult and decay_mult in p3d_model.py, if you have changed they on UCF101 , can you please share the parameter?

bbp94 avatar Feb 28 '19 07:02 bbp94

@jinyu121 , can you give me the data transforms file ?

junaidwahid avatar Mar 10 '19 15:03 junaidwahid