taoyang1122 / adapt-image-models

[ICLR'23] AIM: Adapting Image Models for Efficient Video Action Recognition
Apache License 2.0
278 stars 21 forks source link

A Error in the Running the Train Code. #44

Open YeungChiu opened 1 year ago

YeungChiu commented 1 year ago

Your work is amazing. However I have confusion about running the code for training. I run the given command bash tools/dist_train.sh configs/recognition/vit/vitclip_base_diving48.py 4 --test-last --validate \ --cfg-options model.backbone.pretrained=openaiclip work_dir=work_dirs_vit/diving48/debug in the file run_exp.sh, then the error is

2023-11-17 19:41:19,976 - mmaction - INFO - Evaluating top_k_accuracy ...
Traceback (most recent call last):
  File "tools/train.py", line 210, in <module>
    main()
  File "tools/train.py", line 198, in main
    train_model(
  File "/root/data/adapt-image-models/mmaction/apis/train.py", line 195, in train_model
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs, **runner_kwargs)
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 54, in train
    self.call_hook('after_train_epoch')
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/mmcv/runner/base_runner.py", line 307, in call_hook
    getattr(hook, fn_name)(self)
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/mmcv/runner/hooks/evaluation.py", line 267, in after_train_epoch
    self._do_evaluate(runner)
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/mmcv/runner/hooks/evaluation.py", line 505, in _do_evaluate
    key_score = self.evaluate(runner, results)
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/mmcv/runner/hooks/evaluation.py", line 361, in evaluate
    eval_res = self.dataloader.dataset.evaluate(
  File "/root/data/adapt-image-models/mmaction/datasets/base.py", line 207, in evaluate
    top_k_acc = top_k_accuracy(results, gt_labels, topk)
  File "/root/data/adapt-image-models/mmaction/core/evaluation/accuracy.py", line 104, in top_k_accuracy
    max_k_preds = np.argsort(scores, axis=1)[:, -k:][:, ::-1]
  File "<__array_function__ internals>", line 180, in argsort
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 1120, in argsort
    return _wrapfunc(a, 'argsort', axis=axis, kind=kind, order=order)
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 54, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/root/miniconda3/envs/AIM/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 43, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
numpy.AxisError: axis 1 is out of bounds for array of dimension 1

I will be grateful for your advise.