Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
bbb52e70
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
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看板
提交
bbb52e70
编写于
3月 26, 2018
作者:
W
wanglong03
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix code style problems
上级
774f40dd
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
18 addition
and
14 deletion
+18
-14
fluid/image_classification/caffe2fluid/convert.py
fluid/image_classification/caffe2fluid/convert.py
+3
-2
fluid/image_classification/caffe2fluid/examples/imagenet/infer.py
...age_classification/caffe2fluid/examples/imagenet/infer.py
+12
-9
fluid/image_classification/caffe2fluid/examples/mnist/evaluate.py
...age_classification/caffe2fluid/examples/mnist/evaluate.py
+3
-3
未找到文件。
fluid/image_classification/caffe2fluid/convert.py
浏览文件 @
bbb52e70
...
@@ -49,6 +49,7 @@ def convert(def_path, caffemodel_path, data_output_path, code_output_path,
...
@@ -49,6 +49,7 @@ def convert(def_path, caffemodel_path, data_output_path, code_output_path,
return
0
return
0
def
main
():
def
main
():
""" main
""" main
"""
"""
...
@@ -65,7 +66,7 @@ def main():
...
@@ -65,7 +66,7 @@ def main():
help
=
'The phase to convert: test (default) or train'
)
help
=
'The phase to convert: test (default) or train'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
validate_arguments
(
args
)
validate_arguments
(
args
)
convert
(
args
.
def_path
,
args
.
caffemodel
,
args
.
data_output_path
,
return
convert
(
args
.
def_path
,
args
.
caffemodel
,
args
.
data_output_path
,
args
.
code_output_path
,
args
.
phase
)
args
.
code_output_path
,
args
.
phase
)
...
...
fluid/image_classification/caffe2fluid/examples/imagenet/infer.py
浏览文件 @
bbb52e70
...
@@ -13,6 +13,7 @@ import numpy as np
...
@@ -13,6 +13,7 @@ import numpy as np
import
paddle.v2
as
paddle
import
paddle.v2
as
paddle
import
paddle.v2.fluid
as
fluid
import
paddle.v2.fluid
as
fluid
def
load_data
(
imgfile
,
shape
):
def
load_data
(
imgfile
,
shape
):
h
,
w
=
shape
[
1
:]
h
,
w
=
shape
[
1
:]
from
PIL
import
Image
from
PIL
import
Image
...
@@ -35,7 +36,8 @@ def load_data(imgfile, shape):
...
@@ -35,7 +36,8 @@ def load_data(imgfile, shape):
def
build_model
(
net_file
,
net_name
):
def
build_model
(
net_file
,
net_name
):
print
(
'build model with net_file[%s] and net_name[%s]'
%
(
net_file
,
net_name
))
print
(
'build model with net_file[%s] and net_name[%s]'
%
(
net_file
,
net_name
))
net_path
=
os
.
path
.
dirname
(
net_file
)
net_path
=
os
.
path
.
dirname
(
net_file
)
module_name
=
os
.
path
.
basename
(
net_file
).
rstrip
(
'.py'
)
module_name
=
os
.
path
.
basename
(
net_file
).
rstrip
(
'.py'
)
...
@@ -128,12 +130,13 @@ if __name__ == "__main__":
...
@@ -128,12 +130,13 @@ if __name__ == "__main__":
net_file
=
sys
.
argv
[
1
]
net_file
=
sys
.
argv
[
1
]
weight_file
=
sys
.
argv
[
2
]
weight_file
=
sys
.
argv
[
2
]
imgfile
=
sys
.
argv
[
3
]
imgfile
=
sys
.
argv
[
3
]
net_name
=
sys
.
argv
[
4
]
net_name
=
sys
.
argv
[
4
]
elif
argc
>
1
:
elif
argc
>
1
:
print
(
'usage:'
)
print
(
'usage:'
)
print
(
'
\t
python %s [net_file] [weight_file] [imgfile] [net_name]'
%
(
sys
.
argv
[
0
]))
print
(
'
\t
python %s [net_file] [weight_file] [imgfile] [net_name]'
%
print
(
'
\t
eg:python %s %s %s %s %s'
%
(
sys
.
argv
[
0
],
(
sys
.
argv
[
0
]))
net_file
,
weight_file
,
imgfile
,
net_name
))
print
(
'
\t
eg:python %s %s %s %s %s'
%
(
sys
.
argv
[
0
],
net_file
,
weight_file
,
imgfile
,
net_name
))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
infer
(
net_file
,
net_name
,
weight_file
,
imgfile
)
infer
(
net_file
,
net_name
,
weight_file
,
imgfile
)
fluid/image_classification/caffe2fluid/examples/mnist/evaluate.py
浏览文件 @
bbb52e70
...
@@ -10,6 +10,7 @@ import numpy as np
...
@@ -10,6 +10,7 @@ import numpy as np
import
paddle.v2
as
paddle
import
paddle.v2
as
paddle
import
paddle.v2.fluid
as
fluid
import
paddle.v2.fluid
as
fluid
def
test_model
(
exe
,
test_program
,
fetch_list
,
test_reader
,
feeder
):
def
test_model
(
exe
,
test_program
,
fetch_list
,
test_reader
,
feeder
):
acc_set
=
[]
acc_set
=
[]
...
@@ -79,8 +80,7 @@ if __name__ == "__main__":
...
@@ -79,8 +80,7 @@ if __name__ == "__main__":
elif
argc
>
1
:
elif
argc
>
1
:
print
(
'usage:'
)
print
(
'usage:'
)
print
(
'
\t
python %s [net_file] [weight_file]'
%
(
sys
.
argv
[
0
]))
print
(
'
\t
python %s [net_file] [weight_file]'
%
(
sys
.
argv
[
0
]))
print
(
'
\t
eg:python %s %s %s %s'
%
(
sys
.
argv
[
0
],
print
(
'
\t
eg:python %s %s %s %s'
%
(
sys
.
argv
[
0
],
net_file
,
weight_file
))
net_file
,
weight_file
))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
evaluate
(
net_file
,
weight_file
)
evaluate
(
net_file
,
weight_file
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录