Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
b632c19f
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 1 年 前同步成功
通知
88
Star
4655
Fork
642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VisualDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b632c19f
编写于
12月 27, 2017
作者:
S
superjom
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
image service ready
fix most bugs waiting for frontend to fix interfaces
上级
401e139b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
25 deletion
+37
-25
server/visualdl/lib.py
server/visualdl/lib.py
+19
-5
server/visualdl/run.sh
server/visualdl/run.sh
+3
-1
server/visualdl/visual_dl.py
server/visualdl/visual_dl.py
+15
-19
未找到文件。
server/visualdl/lib.py
浏览文件 @
b632c19f
...
...
@@ -21,6 +21,18 @@ def get_scalar_tags(storage, mode):
return
result
def
get_scalar
(
storage
,
mode
,
tag
):
reader
=
storage
.
as_mode
(
mode
)
scalar
=
reader
.
scalar
(
tag
)
records
=
scalar
.
records
()
ids
=
scalar
.
ids
()
timestamps
=
scalar
.
timestamps
()
result
=
zip
(
timestamps
,
ids
,
records
)
return
result
def
get_image_tags
(
storage
,
mode
):
result
=
{}
...
...
@@ -31,16 +43,17 @@ def get_image_tags(storage, mode):
result
[
mode
]
=
{}
for
tag
in
reader
.
tags
(
'image'
):
image
=
reader
.
image
(
tag
)
if
image
.
num_samples
()
=
=
1
:
if
image
.
num_samples
()
<
=
1
:
result
[
mode
][
tag
]
=
{
'displayName'
:
mage
.
caption
(),
'displayName'
:
i
mage
.
caption
(),
'description'
:
""
,
'samples'
:
1
,
}
else
:
for
i
in
xrange
(
image
.
num_samples
()):
result
[
mode
][
tag
+
'/%d'
%
i
]
=
{
'displayName'
:
image
.
caption
(),
caption
=
tag
+
'/%d'
%
i
result
[
mode
][
caption
]
=
{
'displayName'
:
caption
,
'description'
:
""
,
'samples'
:
1
,
}
...
...
@@ -51,6 +64,7 @@ def get_image_tag_steps(storage, mode, tag):
# remove suffix '/x'
res
=
re
.
search
(
r
".*/([0-9]+$)"
,
tag
)
step_index
=
0
origin_tag
=
tag
if
res
:
tag
=
tag
[:
tag
.
rfind
(
'/'
)]
step_index
=
int
(
res
.
groups
()[
0
])
...
...
@@ -65,7 +79,7 @@ def get_image_tag_steps(storage, mode, tag):
query
=
urllib
.
urlencode
({
'sample'
:
0
,
'index'
:
i
,
'tag'
:
tag
,
'tag'
:
origin_
tag
,
'run'
:
mode
,
})
res
.
append
({
...
...
server/visualdl/run.sh
浏览文件 @
b632c19f
...
...
@@ -2,5 +2,7 @@
set
-ex
export
PYTHONPATH
=
"
$(
pwd
)
/..:/home/superjom/project/VisualDL/build/visualdl/logic:/home/superjom/project/VisualDL/visualdl/python"
export
FLASK_APP
=
visual_dl.py
export
FLASK_DEBUG
=
1
python visual_dl.py
--logdir
./tmp/mock
--host
172.23.233.68
python visual_dl.py
--logdir
./tmp/mock
--host
172.23.233.68
--port
8041
server/visualdl/visual_dl.py
浏览文件 @
b632c19f
...
...
@@ -95,7 +95,8 @@ def runs():
@
app
.
route
(
"/data/plugin/scalars/tags"
)
def
tags
():
def
scalar_tags
():
mode
=
request
.
args
.
get
(
'mode'
)
is_debug
=
bool
(
request
.
args
.
get
(
'debug'
))
if
is_debug
:
result
=
mock_tags
.
data
()
...
...
@@ -107,7 +108,8 @@ def tags():
@
app
.
route
(
"/data/plugin/images/tags"
)
def
tags
():
def
image_tags
():
mode
=
request
.
args
.
get
(
'mode'
)
result
=
lib
.
get_image_tags
(
storage
,
mode
)
print
'tags'
,
result
result
=
gen_result
(
0
,
""
,
result
)
...
...
@@ -120,39 +122,33 @@ def scalars():
tag
=
request
.
args
.
get
(
'tag'
)
is_debug
=
bool
(
request
.
args
.
get
(
'debug'
))
if
is_debug
:
result
=
gen_result
(
0
,
""
,
mock_data
.
sequence_data
()
)
result
=
mock_data
.
sequence_data
(
)
else
:
reader
=
storage
.
as_mode
(
run
)
scalar
=
reader
.
scalar
(
tag
)
records
=
scalar
.
records
()
ids
=
scalar
.
ids
()
timestamps
=
scalar
.
timestamps
()
result
=
zip
(
timestamps
,
ids
,
records
)
result
=
gen_result
(
0
,
""
,
result
)
result
=
lib
.
get_scalar
(
storage
,
run
,
tag
)
result
=
gen_result
(
0
,
""
,
result
)
return
Response
(
json
.
dumps
(
result
),
mimetype
=
'application/json'
)
@
app
.
route
(
'/data/plugin/images/images'
)
def
images
():
run
=
request
.
args
.
get
(
'run'
)
tag
=
request
.
args
.
get
(
'tag'
)
mode
=
request
.
args
.
get
(
'run'
)
#tag = request.args.get('tag')
tag
=
request
.
args
.
get
(
'displayName'
)
res
=
lib
.
gen
_image_tag_steps
(
storage
,
mode
,
tag
)
res
ult
=
lib
.
get
_image_tag_steps
(
storage
,
mode
,
tag
)
return
Response
(
json
.
dumps
(
result
),
mimetype
=
'application/json'
)
@
app
.
route
(
'/data/plugin/images/individualImage'
)
def
individual_image
():
run
=
request
.
args
.
get
(
'run'
)
mode
=
request
.
args
.
get
(
'run'
)
tag
=
request
.
args
.
get
(
'tag'
)
# include a index
index
=
request
.
args
.
get
(
'index'
)
# index of step
step_
index
=
request
.
args
.
get
(
'index'
)
# index of step
offset
=
0
imagefile
=
lib
.
get_invididual_image
(
storage
,
mode
,
tag
)
imagefile
=
lib
.
get_invididual_image
(
storage
,
mode
,
tag
,
step_
)
response
=
send_file
(
imagefile
,
as_attachment
=
True
,
attachment_filename
=
'img.png'
)
return
response
...
...
@@ -160,4 +156,4 @@ def individual_image():
if
__name__
==
'__main__'
:
logger
.
info
(
" port="
+
str
(
options
.
port
))
app
.
run
(
debug
=
Fals
e
,
host
=
options
.
host
,
port
=
options
.
port
)
app
.
run
(
debug
=
Tru
e
,
host
=
options
.
host
,
port
=
options
.
port
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录