Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
19b3be8f
M
models
项目概览
PaddlePaddle
/
models
大约 2 年 前同步成功
通知
232
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
19b3be8f
编写于
9月 26, 2018
作者:
C
CrossLee1
提交者:
qingqing01
9月 26, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix vc bug (#1297)
上级
a6c45e92
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
27 deletion
+33
-27
fluid/video_classification/README.md
fluid/video_classification/README.md
+0
-1
fluid/video_classification/data/generate_train_data.py
fluid/video_classification/data/generate_train_data.py
+30
-24
fluid/video_classification/reader.py
fluid/video_classification/reader.py
+2
-2
fluid/video_classification/train.py
fluid/video_classification/train.py
+1
-0
未找到文件。
fluid/video_classification/README.md
浏览文件 @
19b3be8f
...
@@ -111,7 +111,6 @@ According to the congfiguration of evaluation, the output log is like:
...
@@ -111,7 +111,6 @@ According to the congfiguration of evaluation, the output log is like:
Inference is used to get prediction score or video features based on trained models.
Inference is used to get prediction score or video features based on trained models.
```
```
python infer.py \
python infer.py \
--batch_size=128 \
--class_dim=101 \
--class_dim=101 \
--image_shape=3,224,224 \
--image_shape=3,224,224 \
--with_mem_opt=True \
--with_mem_opt=True \
...
...
fluid/video_classification/data/generate_train_data.py
浏览文件 @
19b3be8f
...
@@ -9,27 +9,33 @@ for line in f.readlines():
...
@@ -9,27 +9,33 @@ for line in f.readlines():
dd
[
name
.
lower
()]
=
int
(
label
)
-
1
dd
[
name
.
lower
()]
=
int
(
label
)
-
1
f
.
close
()
f
.
close
()
# generate pkl
path
=
'train/'
def
generate_pkl
(
mode
):
savepath
=
'train_pkl/'
# generate pkl
if
not
os
.
path
.
exists
(
savepath
):
path
=
'%s/'
%
mode
os
.
makedirs
(
savepath
)
savepath
=
'%s_pkl/'
%
mode
if
not
os
.
path
.
exists
(
savepath
):
fw
=
open
(
'train.list'
,
'w'
)
os
.
makedirs
(
savepath
)
for
folder
in
os
.
listdir
(
path
):
vidid
=
folder
.
split
(
'_'
,
1
)[
1
]
fw
=
open
(
'%s.list'
%
mode
,
'w'
)
this_label
=
dd
[
folder
.
split
(
'_'
)[
1
].
lower
()]
for
folder
in
os
.
listdir
(
path
):
this_feat
=
[]
vidid
=
folder
.
split
(
'_'
,
1
)[
1
]
for
img
in
sorted
(
os
.
listdir
(
path
+
folder
)):
this_label
=
dd
[
folder
.
split
(
'_'
)[
1
].
lower
()]
fout
=
open
(
path
+
folder
+
'/'
+
img
,
'rb'
)
this_feat
=
[]
this_feat
.
append
(
fout
.
read
())
for
img
in
sorted
(
os
.
listdir
(
path
+
folder
)):
fout
.
close
()
fout
=
open
(
path
+
folder
+
'/'
+
img
,
'rb'
)
this_feat
.
append
(
fout
.
read
())
res
=
[
vidid
,
this_label
,
this_feat
]
fout
.
close
()
outp
=
open
(
savepath
+
vidid
+
'.pkl'
,
'wb'
)
res
=
[
vidid
,
this_label
,
this_feat
]
cPickle
.
dump
(
res
,
outp
,
protocol
=
cPickle
.
HIGHEST_PROTOCOL
)
outp
.
close
()
outp
=
open
(
savepath
+
vidid
+
'.pkl'
,
'wb'
)
cPickle
.
dump
(
res
,
outp
,
protocol
=
cPickle
.
HIGHEST_PROTOCOL
)
fw
.
write
(
'data/train_pkl/%s.pkl
\n
'
%
vidid
)
outp
.
close
()
fw
.
close
()
fw
.
write
(
'data/%s/%s.pkl
\n
'
%
(
savepath
,
vidid
))
fw
.
close
()
generate_pkl
(
'train'
)
generate_pkl
(
'test'
)
fluid/video_classification/reader.py
浏览文件 @
19b3be8f
...
@@ -16,8 +16,8 @@ THREAD = 8
...
@@ -16,8 +16,8 @@ THREAD = 8
BUF_SIZE
=
1024
BUF_SIZE
=
1024
TRAIN_LIST
=
'data/train.list'
TRAIN_LIST
=
'data/train.list'
TEST_LIST
=
'data/
val
.list'
TEST_LIST
=
'data/
test
.list'
INFER_LIST
=
'data/
val
.list'
INFER_LIST
=
'data/
test
.list'
img_mean
=
np
.
array
([
0.485
,
0.456
,
0.406
]).
reshape
((
3
,
1
,
1
))
img_mean
=
np
.
array
([
0.485
,
0.456
,
0.406
]).
reshape
((
3
,
1
,
1
))
img_std
=
np
.
array
([
0.229
,
0.224
,
0.225
]).
reshape
((
3
,
1
,
1
))
img_std
=
np
.
array
([
0.229
,
0.224
,
0.225
]).
reshape
((
3
,
1
,
1
))
...
...
fluid/video_classification/train.py
浏览文件 @
19b3be8f
...
@@ -2,6 +2,7 @@ import os
...
@@ -2,6 +2,7 @@ import os
import
numpy
as
np
import
numpy
as
np
import
time
import
time
import
sys
import
sys
import
paddle.v2
as
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
from
resnet
import
TSN_ResNet
from
resnet
import
TSN_ResNet
import
reader
import
reader
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录