首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >[深度学习][原创]mmaction2预测结果top5得分改为0-1

[深度学习][原创]mmaction2预测结果top5得分改为0-1

作者头像
云未归来
发布2025-07-18 17:50:27
发布2025-07-18 17:50:27
850
举报

测试版本:mmaction0.20.0

测试环境:ubuntu18.04

当我们测试tsn模型:

python demo/demo.py configs/recognition/tsn/tsn_r50_video_inference_1x1x3_100e_kinetics400_rgb.py checkpoints/tsn_r50_1x1x3_100e_kinetics400_rgb_20200614-e508be42.pth demo/demo.mp4 tools/data/kinetics/label_map_k400.txt

结果显示:

load checkpoint from local path: checkpoints/tsn_r50_1x1x3_100e_kinetics400_rgb_20200614-e508be42.pth The top-5 labels with corresponding scores are: arm wrestling:  29.61644 rock scissors paper:  10.754842 shaking hands:  9.908401 clapping:  9.189913 massaging feet:  8.305306 显然上面得分>1不符合0-1概率,因此如何改为0-1概率显示呢。

方法如下:

经过测试发现tsn_r50_video_inference_1x1x3_100e_kinetics400_rgb.py加入test_cfg已经没有效果,正确做法就是:

去mmaction2-0.20.0/configs/_base_/models/tsn_r50.py将tesct_cfg改为

test_cfg = dict(average_clips='prob', test_crops=1))

最终文件内容结果:

# model settings model = dict(     type='Recognizer2D',     backbone=dict(         type='ResNet',         pretrained='torchvision://resnet50',         depth=50,         norm_eval=False),     cls_head=dict(         type='TSNHead',         num_classes=400,         in_channels=2048,         spatial_type='avg',         consensus=dict(type='AvgConsensus', dim=1),         dropout_ratio=0.4,         init_std=0.01),     # model training and testing settings     train_cfg=None,     test_cfg = dict(average_clips='prob', test_crops=1))

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-12-14,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档