open-mmlab / mmaction2

OpenMMLab's Next Generation Video Understanding Toolbox and Benchmark
https://mmaction2.readthedocs.io
Apache License 2.0
4.21k stars 1.23k forks source link

[Bug] Fail to use confusion_matrix to RGBPoseC3D #2815

Open HoBeom opened 6 months ago

HoBeom commented 6 months ago

Branch

main branch (1.x version, such as v1.0.0, or dev-1.x branch)

Prerequisite

Environment

sys.platform: linux Python: 3.9.17 (main, Jul 5 2023, 20:41:20) [GCC 11.2.0] CUDA available: True numpy_random_seed: 2147483648 GPU 0,1,2,3: NVIDIA GeForce RTX 4090 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.8, V11.8.89 GCC: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 PyTorch: 2.0.1+cu117 PyTorch compiling details: PyTorch built with:

TorchVision: 0.15.2 OpenCV: 4.8.0 MMEngine: 0.8.2 MMAction2: 1.2.0+4d6c934 MMCV: 2.0.1 MMDetection: 3.1.0

Describe the bug

While attempting to configure evaluators for validation and testing phases for the RGBPoseC3D, I encountered an issue where specifying ConfusionMatrix as part of the evaluators does not work as expected.

Reproduces the problem - code sample

The configuration is defined in configs/skeleton/posec3d/rgbpose_conv3d/rgbpose_conv3d.py. The relevant section of the configuration is as follows:

val_evaluator = [dict(type='AccMetric'), dict(type='ConfusionMatrix')]
test_evaluator = val_evaluator

Reproduces the problem - command or script

 ./tools/dist_train.sh configs/skeleton/posec3d/rgbpose_conv3d/rgbpose_conv3d.py 4

Reproduces the problem - error message

mmaction/evaluation/metrics/acc_metric.py", line 252, in process
    pred_label = pred_scores.argmax(dim=0, keepdim=True)
AttributeError: 'dict' object has no attribute 'argmax'

Additional information

The modified version in my branch, which was adjusted to operate identically to the AccMetric module, functions only for specific purposes. There is a need to redesign the abstraction of the evaluation code.

lmc2000 commented 5 months ago

解决了吗?

HoBeom commented 5 months ago

@lmc2000 Use modified version in my branch

https://github.com/HoBeom/mmaction2/blob/789c12d53ab830c8a7bfc01e34ae9ef777d8f775/mmaction/evaluation/metrics/acc_metric.py#L272-L300

lmc2000 commented 5 months ago

谢谢,我也对我自己的代码做了相应的修改