Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openvinotoolkit
mmaction2
提交
212adf7b
M
mmaction2
项目概览
openvinotoolkit
/
mmaction2
10 个月 前同步成功
通知
2
Star
5
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mmaction2
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
212adf7b
编写于
2月 15, 2020
作者:
L
linjintao
提交者:
chenkai
2月 15, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
take AdaptiveAvgPoolnd to replace origin one
上级
28e036c9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
6 addition
and
21 deletion
+6
-21
config/i3d_rgb_32x2x1_r50_3d_kinetics400_100e.py
config/i3d_rgb_32x2x1_r50_3d_kinetics400_100e.py
+0
-2
config/tsn_rgb_1x1x3_r50_2d_kinetics400_100e.py
config/tsn_rgb_1x1x3_r50_2d_kinetics400_100e.py
+0
-1
mmaction/models/heads/i3d_head.py
mmaction/models/heads/i3d_head.py
+2
-9
mmaction/models/heads/tsn_head.py
mmaction/models/heads/tsn_head.py
+4
-9
未找到文件。
config/i3d_rgb_32x2x1_r50_3d_kinetics400_100e.py
浏览文件 @
212adf7b
...
...
@@ -14,8 +14,6 @@ model = dict(
num_classes
=
400
,
in_channels
=
2048
,
spatial_type
=
'avg'
,
spatial_size
=
7
,
temporal_size
=
4
,
dropout_ratio
=
0.5
,
init_std
=
0.01
))
# model training and testing settings
...
...
config/tsn_rgb_1x1x3_r50_2d_kinetics400_100e.py
浏览文件 @
212adf7b
...
...
@@ -11,7 +11,6 @@ model = dict(
num_classes
=
400
,
in_channels
=
2048
,
spatial_type
=
'avg'
,
spatial_size
=
7
,
consensus
=
dict
(
type
=
'AvgConsensus'
,
dim
=
1
),
dropout_ratio
=
0.4
,
init_std
=
0.01
))
...
...
mmaction/models/heads/i3d_head.py
浏览文件 @
212adf7b
import
mmcv
import
torch.nn
as
nn
from
mmcv.cnn.weight_init
import
normal_init
from
torch.nn.modules.utils
import
_pair
from
..registry
import
HEADS
from
.base
import
BaseHead
...
...
@@ -27,17 +25,11 @@ class I3DHead(BaseHead):
num_classes
,
in_channels
=
2048
,
spatial_type
=
'avg'
,
spatial_size
=
7
,
temporal_size
=
4
,
dropout_ratio
=
0.5
,
init_std
=
0.01
):
super
(
I3DHead
,
self
).
__init__
(
num_classes
,
in_channels
)
self
.
spatial_size
=
_pair
(
spatial_size
)
assert
mmcv
.
is_tuple_of
(
self
.
spatial_size
,
int
)
self
.
spatial_type
=
spatial_type
self
.
temporal_size
=
temporal_size
self
.
pool_size
=
(
self
.
temporal_size
,
)
+
self
.
spatial_size
self
.
dropout_ratio
=
dropout_ratio
self
.
init_std
=
init_std
if
self
.
dropout_ratio
!=
0
:
...
...
@@ -47,7 +39,8 @@ class I3DHead(BaseHead):
self
.
fc_cls
=
nn
.
Linear
(
self
.
in_channels
,
self
.
num_classes
)
if
self
.
spatial_type
==
'avg'
:
self
.
avg_pool
=
nn
.
AvgPool3d
(
self
.
pool_size
,
stride
=
1
,
padding
=
0
)
# use `nn.AdaptiveAvgPool3d` to adaptively match the in_channels.
self
.
avg_pool
=
nn
.
AdaptiveAvgPool3d
((
1
,
1
,
1
))
else
:
self
.
avg_pool
=
None
...
...
mmaction/models/heads/tsn_head.py
浏览文件 @
212adf7b
import
mmcv
import
torch.nn
as
nn
from
mmcv.cnn.weight_init
import
normal_init
from
torch.nn.modules.utils
import
_pair
from
..registry
import
HEADS
from
.base
import
BaseHead
...
...
@@ -41,13 +39,10 @@ class TSNHead(BaseHead):
num_classes
,
in_channels
=
2048
,
spatial_type
=
'avg'
,
spatial_size
=
7
,
consensus
=
dict
(
type
=
'AvgConsensus'
,
dim
=
1
),
dropout_ratio
=
0.4
,
init_std
=
0.01
):
super
(
TSNHead
,
self
).
__init__
(
num_classes
,
in_channels
)
self
.
spatial_size
=
_pair
(
spatial_size
)
assert
mmcv
.
is_tuple_of
(
self
.
spatial_size
,
int
)
self
.
spatial_type
=
spatial_type
self
.
dropout_ratio
=
dropout_ratio
...
...
@@ -60,10 +55,10 @@ class TSNHead(BaseHead):
self
.
consensus
=
None
if
self
.
spatial_type
==
'avg'
:
self
.
avg_pool2d
=
nn
.
AvgPool2d
(
self
.
spatial_size
,
stride
=
1
,
padding
=
0
)
# use `nn.AdaptiveAvgPool2d` to adaptively match the in_channels.
self
.
avg_pool
=
nn
.
AdaptiveAvgPool2d
((
1
,
1
)
)
else
:
self
.
avg_pool
2d
=
None
self
.
avg_pool
=
None
if
self
.
dropout_ratio
!=
0
:
self
.
dropout
=
nn
.
Dropout
(
p
=
self
.
dropout_ratio
)
...
...
@@ -76,7 +71,7 @@ class TSNHead(BaseHead):
def
forward
(
self
,
x
,
num_segs
):
# [N * num_segs, in_channels, 7, 7]
x
=
self
.
avg_pool
2d
(
x
)
x
=
self
.
avg_pool
(
x
)
# [N * num_segs, in_channels, 1, 1]
x
=
x
.
reshape
((
-
1
,
num_segs
)
+
x
.
shape
[
1
:])
# [N, num_segs, in_channels, 1, 1]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录