JimLee1996 / AVSS2019

Efficient Violence Detection Using 3D Convolutional Neural Networks
MIT License
15 stars 10 forks source link

Training C3D model #11

Closed SonNguyen2510 closed 1 year ago

SonNguyen2510 commented 3 years ago

Thank you for your great work! I am very interested in your research and I am trying to retrain the C3D model to compare the result with the DenseNet Lean model. When loading the pretrain weight, I have set the strict = False and I get the models with size equal 110 MB while the pretrain weight is 312 MB. Is it normal? And I have test my model with the test set and the result is my model cannot detect any violent behavior. Could you tell me how to retrain the C3D model? Thank you very much!

p/s: with the same training data, the DenseNet Lean model can perform well on test set, however C3D model always returns nonviolence

JimLee1996 commented 3 years ago

Hi, Nguyen~

The 312MB C3D model contains the flattened and full FC layers, which is replaces with global average pooling in 110MB model. (We use the C3D descriptor as 3D Conv feature extractor, so the redundant FC layers are dropped to avoid overfitting.) And it is the right way to load the state_dict with param strict=False.

JimLee1996 commented 3 years ago

As for the C3D model always returns non-violence results, is the output normalized or is a proper threshold chosen?

SonNguyen2510 commented 3 years ago

Thank you for the answer. I'm choosing the threshold equal 0.5 and using the demo code to test the model. During the training process, I use the data set that I prepared myself. I have divided the data set into 2 folders, fi and no, and placed them in the VioDB folder. Then I use the code "annotation_kfold.ipynb" to create the json file. Are there any tips when preparing data? Did I prepare the wrong data somewhere?

JimLee1996 commented 3 years ago

Could you please provide training and validation logs? I'll try to find whether bug exists.

SonNguyen2510 commented 3 years ago

These are my log files. Thank you for spending your time consider my problem C3D_log_files.tar.gz

JimLee1996 commented 3 years ago

It looks normal on train and validation from logs. Maybe, did you use a private dataset for testing?

SonNguyen2510 commented 3 years ago

The data set I used for testing was split from the data set I used for training. In the training code, you use normalize before training the model, however in Demo code you didn't use it. Does it affect the testing process?

SonNguyen2510 commented 3 years ago

Thanks a lot for your help, I think I found my mistake, the problem is normalizing the data before putting it on the network. One more time thank you very much!

JimLee1996 commented 3 years ago

You're welcome. ;-)

ducMNSD commented 3 years ago

Hello, maybe I have a same problem when I test by @JimLee1996 's Demo_code, but the results always return no-violence. I'm wondering if I'm making the same mistake as @SonNguyen2510 ?

SonNguyen2510 commented 3 years ago

Hello, maybe I have a same problem when I test by @JimLee1996 's Demo_code, but the results always return no-violence. I'm wondering if I'm making the same mistake as @SonNguyen2510 ?

For my problem, as I mention above, input data must be normalized before feeding to the 3D CNN for violence detection. You can try and see if it solves your problem.

ducMNSD commented 3 years ago

At the moment, I'm using dense-lean to train with my dataset. The results is not good. @SonNguyen2510 , when you trained 3D CNN, which model do you think is better?

SonNguyen2510 commented 3 years ago

I'm using DenseNet Lean too. I have test with C3D but its performance is not good as Dense-lean

At the moment, I'm using dense-lean to train with my dataset. The results is not good. @SonNguyen2510 , when you trained 3D CNN, which model do you think is better?

ducMNSD commented 3 years ago

I'm using DenseNet Lean too. I have test with C3D but its performance is not good as Dense-lean

At the moment, I'm using dense-lean to train with my dataset. The results is not good. @SonNguyen2510 , when you trained 3D CNN, which model do you think is better?

Thank you very much

ducMNSD commented 2 years ago

Hello @SonNguyen2510 , could you give me your checkpoint to compare the pretrained. Thank you so much !!!