wei-tim / YOWO

You Only Watch Once: A Unified CNN Architecture for Real-Time Spatiotemporal Action Localization
840 stars 161 forks source link

@abhigoku10 #58

Open chuong opened 3 years ago

chuong commented 3 years ago

@abhigoku10

  1. Yes, please investigate the "def test(epoch)" function in file https://github.com/wei-tim/YOWO/blob/master/train.py
  2. Yes you can. This is how the training is done. Frames are read from offline recorded videos. You can write a script to test.
  3. If you load a pretrained model shared in the README, you do not need to load backbones separately. If you want to make training, you need to load the backbone weights. But always you should specify which backbones you are using since the model is created accordingly.
  4. You can simply download the pretrained models.
  5. Yes you can run the model on cpu if you write a script accordingly.

Originally posted by @okankop in https://github.com/wei-tim/YOWO/issues/11#issuecomment-591884260

chuong commented 3 years ago

@okankop: load pretrain model does not require loading backbones. However skipping backbone arguments causes error:

$ python train.py --dataset ucf101-24 --data_cfg cfg/ucf24.data --cfg_file cfg/ucf24.cfg --n_classes 24 --resume_path weights/yowo_ucf101-24_16f_best.pth --evaluate
Traceback (most recent call last):
  File "train.py", line 89, in <module>
    model = YOWO(opt)
  File "/repos/YOWO/model.py", line 29, in __init__
    it from [darknet]")
ValueError: Wrong backbone_2d model is requested. Please select                              it from [darknet]

If I keep all the arguments and provide all pretrained models, evaluation produces results of zeros:

$ python train.py --dataset ucf101-24 --data_cfg cfg/ucf24.data --cfg_file cfg/ucf24.cfg --n_classes 24 --backbone_3d resnext101 --backbone_3d_weights weights/resnext-101-kinetics.pth --backbone_2d darknet --backbone_2d_weights weights/yolo.weights --resume_path weights/yowo_ucf101-24_16f_best.pth --evaluate
DataParallel(
  (module): YOWO(
    (backbone_2d): Darknet(
..........................
    (conv_final): Conv2d(1024, 145, kernel_size=(1, 1), stride=(1, 1), bias=False)
  )
)

===================================================================
loading checkpoint weights/yowo_ucf101-24_16f_best.pth
Loaded model fscore:  0.9151895290027773
===================================================================
2020-09-30 00:25:33 evaluating ...
2020-09-30 00:25:34 validation at epoch 0
/repos/YOWO/utils.py:280: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
  cls_confs = torch.nn.Softmax()(Variable(output[5:5+num_classes].transpose(0,1))).data
2020-09-30 00:25:42 [0/22926] precision: 0.000000, recall: 0.000000, fscore: 0.000000
2020-09-30 00:25:42 [1/22926] precision: 0.000000, recall: 0.000000, fscore: 0.000000
2020-09-30 00:25:43 [2/22926] precision: 0.000000, recall: 0.000000, fscore: 0.000000
..............................................

Please help with this.

wjtan99 commented 3 years ago

@chuong

I ran

python train.py --dataset ucf101-24 --data_cfg cfg/ucf24.data --cfg_file cfg/ucf24.cfg --n_classes 24 --backbone_3d resnext101 --backbone_3d_weights weights/resnext-101-kinetics.pth --backbone_2d darknet --resume_path weights/yowo_ucf101-24_16f_best.pth --evaluate

The first a few lines gave all 0, but after that non-zero results showed up:

2020-11-10 13:15:11 [313/11463] precision: 0.741367, recall: 0.776899, fscore: 0.758713 2020-11-10 13:15:11 [314/11463] precision: 0.742075, recall: 0.777539, fscore: 0.759388 2020-11-10 13:15:12 [315/11463] precision: 0.742779, recall: 0.778175, fscore: 0.760060 2020-11-10 13:15:12 [316/11463] precision: 0.743479, recall: 0.778807, fscore: 0.760728 2020-11-10 13:15:13 [317/11463] precision: 0.744176, recall: 0.779436, fscore: 0.761393 2020-11-10 13:15:14 [318/11463] precision: 0.744868, recall: 0.780061, fscore: 0.762054

C-popKingJames commented 2 years ago

@okankop: load pretrain model does not require loading backbones. However skipping backbone arguments causes error:

$ python train.py --dataset ucf101-24 --data_cfg cfg/ucf24.data --cfg_file cfg/ucf24.cfg --n_classes 24 --resume_path weights/yowo_ucf101-24_16f_best.pth --evaluate
Traceback (most recent call last):
  File "train.py", line 89, in <module>
    model = YOWO(opt)
  File "/repos/YOWO/model.py", line 29, in __init__
    it from [darknet]")
ValueError: Wrong backbone_2d model is requested. Please select                              it from [darknet]

If I keep all the arguments and provide all pretrained models, evaluation produces results of zeros:

$ python train.py --dataset ucf101-24 --data_cfg cfg/ucf24.data --cfg_file cfg/ucf24.cfg --n_classes 24 --backbone_3d resnext101 --backbone_3d_weights weights/resnext-101-kinetics.pth --backbone_2d darknet --backbone_2d_weights weights/yolo.weights --resume_path weights/yowo_ucf101-24_16f_best.pth --evaluate
DataParallel(
  (module): YOWO(
    (backbone_2d): Darknet(
..........................
    (conv_final): Conv2d(1024, 145, kernel_size=(1, 1), stride=(1, 1), bias=False)
  )
)

===================================================================
loading checkpoint weights/yowo_ucf101-24_16f_best.pth
Loaded model fscore:  0.9151895290027773
===================================================================
2020-09-30 00:25:33 evaluating ...
2020-09-30 00:25:34 validation at epoch 0
/repos/YOWO/utils.py:280: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
  cls_confs = torch.nn.Softmax()(Variable(output[5:5+num_classes].transpose(0,1))).data
2020-09-30 00:25:42 [0/22926] precision: 0.000000, recall: 0.000000, fscore: 0.000000
2020-09-30 00:25:42 [1/22926] precision: 0.000000, recall: 0.000000, fscore: 0.000000
2020-09-30 00:25:43 [2/22926] precision: 0.000000, recall: 0.000000, fscore: 0.000000
..............................................

Please help with this. I also meet this fucking problem,how can i solve it

sanersbug commented 2 years ago

@chuong @C-popKingJames Any one solved this problem?

C-popKingJames commented 2 years ago

No, I also wanna to find this problem