cmhungsteve / TA3N

[ICCV 2019 (Oral)] Temporal Attentive Alignment for Large-Scale Video Domain Adaptation (PyTorch)
https://arxiv.org/abs/1907.12743
MIT License
259 stars 41 forks source link

Cannot run code using default save_attention setting #16

Closed xuyu0010 closed 4 years ago

xuyu0010 commented 4 years ago

Thank you for the wonderful code.

However, when trying to reproduce the results, I am getting errors using the default setting in opts.py. I found that when running it would produce the following error:

Traceback (most recent call last):
  File "main.py", line 836, in <module>
    main()
  File "main.py", line 240, in main
    loss_c, attn_epoch_source, attn_epoch_target = train(num_class, source_loader, target_loader, model, criterion, criterion_domain, optimizer, epoch, train_file, train_short_file, alpha, beta, gamma, mu)
  File "main.py", line 668, in train
    return losses_c.avg, attn_epoch_source.mean(0), attn_epoch_target.mean(0)
RuntimeError: invalid argument 2: invalid dimension 0 at /opt/conda/conda-bld/pytorch_1524584710464/work/aten/src/TH/generic/THTensorMath.c:3897

After checking, I suspect that the save_attention argument was the cause, and I change the default from -1 to 0. Although now it could run, I am getting only 73.89% accuracy. Could you help explain why the save_attention was set to -1? And what is the meaning of it setting to different values? Thank you!

xuyu0010 commented 4 years ago

Hi, I realize that my PyTorch version was set to Pyt=Torch 0.4.0. When I switched to PyTorch 0.4.1, this error does not occur and the program ran smoothly. Closing this issue. Thank you for the code!