File "/home/zrb/anaconda3/envs/open-mmlab/bin/mmskl", line 7, in <module> exec(compile(f.read(), __file__, 'exec')) File "/home/zrb/mmskeleton/tools/mmskl", line 123, in <module> main() File "/home/zrb/mmskeleton/tools/mmskl", line 117, in main call_obj(**cfg.processor_cfg) File "/home/zrb/mmskeleton/mmskeleton/utils/importer.py", line 24, in call_obj return import_obj(type)(**kwargs) File "/home/zrb/mmskeleton/mmskeleton/processor/recognition.py", line 47, in test output = model(data) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward return self.module(*inputs[0], **kwargs[0]) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/home/zrb/mmskeleton/mmskeleton/models/backbones/st_gcn_aaai18.py", line 94, in forward x = self.data_bn(x) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/batchnorm.py", line 81, in forward exponential_average_factor, self.eps) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/functional.py", line 1656, in batch_norm training, momentum, eps, torch.backends.cudnn.enabled RuntimeError: running_mean should contain 60 elements not 54
时间: 2023-08-08 16:04:39 浏览: 150
这个错误是由于在运行您的代码时发生的。根据错误信息,问题发生在代码的这一部分:
```python
File "/home/zrb/mmskeleton/mmskeleton/models/backbones/st_gcn_aaai18.py", line 94, in forward
x = self.data_bn(x)
```
根据错误信息,`running_mean` 应该包含 60 个元素,但是它只有 54 个元素。这可能是因为您的输入数据的维度与模型期望的维度不匹配。
要解决这个问题,您可以尝试检查输入数据的维度,并确保它与模型期望的维度匹配。您还可以检查模型的配置文件或代码中是否有任何错误或不一致之处。
如果您需要更多帮助,请提供更多关于您的代码和数据的详细信息。
相关问题
Load configuration information from configs/recognition/st_gcn_aaai18/kinetics-skeleton/test.yaml [ ] 0/86, elapsed: 0s, ETA:Traceback (most recent call last): File "/home/zrb/anaconda3/envs/open-mmlab/bin/mmskl", line 7, in <module> exec(compile(f.read(), __file__, 'exec')) File "/home/zrb/mmskeleton/tools/mmskl", line 123, in <module> main() File "/home/zrb/mmskeleton/tools/mmskl", line 117, in main call_obj(**cfg.processor_cfg) File "/home/zrb/mmskeleton/mmskeleton/utils/importer.py", line 24, in call_obj return import_obj(type)(**kwargs) File "/home/zrb/mmskeleton/mmskeleton/processor/recognition.py", line 47, in test output = model(data) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward return self.module(*inputs[0], **kwargs[0]) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/home/zrb/mmskeleton/mmskeleton/models/backbones/st_gcn_aaai18.py", line 94, in forward x = self.data_bn(x) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__ result = self.forward(*input, **kwargs) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/batchnorm.py", line 81, in forward exponential_average_factor, self.eps) File "/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/functional.py", line 1656, in batch_norm training, momentum, eps, torch.backends.cudnn.enabled RuntimeError: running_mean should contain 60 elements not 54
根据你提供的错误信息,看起来是由于`running_mean`的维度不匹配导致的运行时错误。这通常是由于加载的模型权重与模型结构不匹配或数据预处理不正确导致的。
可能的原因和解决方法如下:
1. 模型结构不匹配:请确保加载的模型权重与所使用的模型结构相匹配。如果模型结构发生了变化,例如添加或删除了一些层,请确保加载相应的权重文件。
2. 数据预处理错误:请检查数据预处理的代码,特别是归一化和输入维度的处理。确认数据预处理与模型训练时一致。
3. 数据集不匹配:请确保使用的验证集数据与模型训练时使用的数据集相匹配。如果数据集不匹配,可以尝试重新划分或准备相应的验证集数据。
如果以上方法不起作用,可以尝试重新训练模型或与模型提供者或开发者联系以获取更多帮助。
希望这些信息对你有帮助!如果还有其他问题,请随时向我提问。
gcc -pthread -B /home/zrb/anaconda3/envs/open-mmlab/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DMMCV_WITH_CUDA -I/home/zrb/mmskeleton/mmcv/mmcv/ops/csrc/pytorch -I/home/zrb/mmskeleton/mmcv/mmcv/ops/csrc/common -I/home/zrb/mmskeleton/mmcv/mmcv/ops/csrc/common/cuda -I/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/include -I/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/include/TH -I/home/zrb/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/bin/include -I/home/zrb/anaconda3/envs/open-mmlab/include/python3.7m -c ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp -o build/temp.linux-x86_64-cpython-37/./mmcv/ops/csrc/pytorch/active_rotated_filter.o -std=c++14 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=1 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
这个警告是编译器提示你,`-Wstrict-prototypes` 这个命令行选项只适用于 C/ObjC,而不适用于 C++。它是一个过时的选项,用于启用对函数原型严格检查的警告提示。
在你的编译命令中,`-Wstrict-prototypes` 是一个无效的选项,因为你正在编译的是 C++ 代码,而不是 C 代码。编译器已经忽略了这个选项,并给出了一条警告。
如果你想开启警告提示,建议使用 `-Wall` 选项,它会启用大部分的警告提示。如果需要更严格的警告提示,可以使用 `-Wextra` 选项。但请注意,这些选项都适用于 C++ 代码,而不是 C 代码。
阅读全文