Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the accuracy #25

Open
bbp94 opened this issue Jan 15, 2019 · 11 comments
Open

About the accuracy #25

bbp94 opened this issue Jan 15, 2019 · 11 comments

Comments

@bbp94
Copy link

bbp94 commented Jan 15, 2019

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

@jinyu121
Copy link

jinyu121 commented Jan 22, 2019

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

@bbp94
Copy link
Author

bbp94 commented Jan 25, 2019

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.

@jinyu121
Copy link

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

@jinyu121
Copy link

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.

@bbp94
Copy link
Author

bbp94 commented Feb 25, 2019

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

@jinyu121
Copy link

jinyu121 commented Feb 25, 2019

{
  "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.

@bbp94
Copy link
Author

bbp94 commented Feb 27, 2019

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

@jinyu121
Copy link

jinyu121 commented Feb 27, 2019

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!

@top1
Copy link

top1 commented Feb 27, 2019

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

@bbp94
Copy link
Author

bbp94 commented Feb 28, 2019

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

@junaidwahid
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants