PaddlePaddle / PaddleVideo

Awesome video understanding toolkits based on PaddlePaddle. It supports video data annotation tools, lightweight RGB and skeleton based action recognition model, practical applications for video tagging and sport action detection.
Apache License 2.0
1.46k stars 374 forks source link

AttributeError: 'NoneType' object has no attribute 'test' #676

Open Bradly-s opened 5 months ago

Bradly-s commented 5 months ago

利用summary.py工具对videoswin模型进行计算参数量时报错: Traceback (most recent call last): File "tools/summary.py", line 113, in main() File "tools/summary.py", line 96, in main params_info = paddle.summary(model, (1, 1, num_seg, 3, img_size, img_size)) File "/home/pl/anaconda3/envs/swfpd/lib/python3.7/site-packages/paddle/hapi/model_summary.py", line 308, in summary result, params_info = summary_string(net, _input_size, dtypes, input) File "/home/pl/anaconda3/envs/swfpd/lib/python3.7/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), *kw) File "/home/pl/anaconda3/envs/swfpd/lib/python3.7/site-packages/paddle/base/dygraph/base.py", line 350, in _decorate_function return func(args, kwargs) File "/home/pl/anaconda3/envs/swfpd/lib/python3.7/site-packages/paddle/hapi/model_summary.py", line 444, in summary_string model(x) File "/home/pl/anaconda3/envs/swfpd/lib/python3.7/site-packages/paddle/nn/layer/layers.py", line 1423, in call return self.forward(inputs, kwargs) File "/mnt/sdb1/swf/project/PaddleVideo/paddlevideo/modeling/framework/recognizers/base.py", line 55, in forward return self.infer_step(data_batch) File "/mnt/sdb1/swf/project/PaddleVideo/paddlevideo/modeling/framework/recognizers/recognizer_transformer.py", line 73, in infer_step num_views = imgs.shape[2] // self.runtime_cfg.test.num_seg AttributeError: 'NoneType' object has no attribute 'test'

westfish commented 5 months ago

通常发生在配置文件(可能是模型的运行时配置)没有被正确加载或初始化,这里的关键是要确保runtime_cfg对象正确地包含了期望的test部分。

另外,如果有图像、视频理解和生成的需求,可以使用我们新的跨模态工具: https://github.com/PaddlePaddle/PaddleMIX/tree/develop