Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
b5026ee0
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看板
未验证
提交
b5026ee0
编写于
9月 03, 2020
作者:
走神的阿圆
提交者:
GitHub
9月 03, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
s2ms (#781)
上级
52f26263
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
14 deletion
+18
-14
visualdl/server/lib.py
visualdl/server/lib.py
+10
-6
visualdl/writer/writer.py
visualdl/writer/writer.py
+8
-8
未找到文件。
visualdl/server/lib.py
浏览文件 @
b5026ee0
...
...
@@ -22,6 +22,10 @@ from visualdl.io import bfile
from
visualdl.utils.string_util
import
encode_tag
,
decode_tag
def
s2ms
(
timestamp
):
return
timestamp
*
1000
if
timestamp
<
2000000000
else
timestamp
def
get_components
(
log_reader
):
components
=
log_reader
.
components
(
update
=
True
)
components
.
add
(
'graph'
)
...
...
@@ -77,7 +81,7 @@ def get_scalar(log_reader, run, tag):
log_reader
.
load_new_data
()
records
=
log_reader
.
data_manager
.
get_reservoir
(
"scalar"
).
get_items
(
run
,
decode_tag
(
tag
))
results
=
[[
item
.
timestamp
,
item
.
id
,
item
.
value
]
for
item
in
records
]
results
=
[[
s2ms
(
item
.
timestamp
)
,
item
.
id
,
item
.
value
]
for
item
in
records
]
return
results
...
...
@@ -92,7 +96,7 @@ def get_image_tag_steps(log_reader, run, tag):
run
,
decode_tag
(
tag
))
result
=
[{
"step"
:
item
.
id
,
"wallTime"
:
item
.
timestamp
"wallTime"
:
s2ms
(
item
.
timestamp
)
}
for
item
in
records
]
return
result
...
...
@@ -116,7 +120,7 @@ def get_audio_tag_steps(log_reader, run, tag):
run
,
decode_tag
(
tag
))
result
=
[{
"step"
:
item
.
id
,
"wallTime"
:
item
.
timestamp
"wallTime"
:
s2ms
(
item
.
timestamp
)
}
for
item
in
records
]
return
result
...
...
@@ -152,7 +156,7 @@ def get_pr_curve(log_reader, run, tag):
pr_curve
=
item
.
pr_curve
length
=
len
(
pr_curve
.
precision
)
num_thresholds
=
[
float
(
v
)
/
length
for
v
in
range
(
1
,
length
+
1
)]
results
.
append
([
item
.
timestamp
,
results
.
append
([
s2ms
(
item
.
timestamp
)
,
item
.
id
,
list
(
pr_curve
.
precision
),
list
(
pr_curve
.
recall
),
...
...
@@ -171,7 +175,7 @@ def get_pr_curve_step(log_reader, run, tag=None):
log_reader
.
load_new_data
()
records
=
log_reader
.
data_manager
.
get_reservoir
(
"pr_curve"
).
get_items
(
run
,
decode_tag
(
tag
))
results
=
[[
item
.
timestamp
,
item
.
id
]
for
item
in
records
]
results
=
[[
s2ms
(
item
.
timestamp
)
,
item
.
id
]
for
item
in
records
]
return
results
...
...
@@ -213,7 +217,7 @@ def get_histogram(log_reader, run, tag):
histogram_data
=
[]
for
index
in
range
(
len
(
hist
)):
histogram_data
.
append
([
bin_edges
[
index
],
bin_edges
[
index
+
1
],
hist
[
index
]])
results
.
append
([
item
.
timestamp
,
item
.
id
,
histogram_data
])
results
.
append
([
s2ms
(
item
.
timestamp
)
,
item
.
id
,
histogram_data
])
return
results
...
...
visualdl/writer/writer.py
浏览文件 @
b5026ee0
...
...
@@ -138,7 +138,7 @@ class LogWriter(object):
"""
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
walltime
=
round
(
time
.
time
())
if
walltime
is
None
else
walltime
walltime
=
round
(
time
.
time
()
*
1000
)
if
walltime
is
None
else
walltime
self
.
_get_file_writer
().
add_record
(
meta_data
(
tag
=
tag
,
display_name
=
display_name
,
step
=
step
,
walltime
=
walltime
))
...
...
@@ -159,7 +159,7 @@ class LogWriter(object):
"""
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
walltime
=
round
(
time
.
time
())
if
walltime
is
None
else
walltime
walltime
=
round
(
time
.
time
()
*
1000
)
if
walltime
is
None
else
walltime
self
.
_get_file_writer
().
add_record
(
scalar
(
tag
=
tag
,
value
=
value
,
step
=
step
,
walltime
=
walltime
))
...
...
@@ -182,7 +182,7 @@ class LogWriter(object):
"""
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
walltime
=
round
(
time
.
time
())
if
walltime
is
None
else
walltime
walltime
=
round
(
time
.
time
()
*
1000
)
if
walltime
is
None
else
walltime
self
.
_get_file_writer
().
add_record
(
image
(
tag
=
tag
,
image_array
=
img
,
step
=
step
,
walltime
=
walltime
))
...
...
@@ -207,7 +207,7 @@ class LogWriter(object):
labels = ["label_1", "label_2", "label_3", "label_4", "label_5"]
writer.add_embedding(labels=labels, vectors=hot_vectors,
walltime=round(time.time()))
walltime=round(time.time()
* 1000
))
"""
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
...
...
@@ -216,7 +216,7 @@ class LogWriter(object):
if
isinstance
(
labels
,
np
.
ndarray
):
labels
=
labels
.
tolist
()
step
=
0
walltime
=
round
(
time
.
time
())
if
walltime
is
None
else
walltime
walltime
=
round
(
time
.
time
()
*
1000
)
if
walltime
is
None
else
walltime
self
.
_get_file_writer
().
add_record
(
embedding
(
tag
=
tag
,
...
...
@@ -260,7 +260,7 @@ class LogWriter(object):
"""
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
walltime
=
round
(
time
.
time
())
if
walltime
is
None
else
walltime
walltime
=
round
(
time
.
time
()
*
1000
)
if
walltime
is
None
else
walltime
if
isinstance
(
audio_array
,
list
):
audio_array
=
np
.
array
(
audio_array
)
self
.
_get_file_writer
().
add_record
(
...
...
@@ -297,7 +297,7 @@ class LogWriter(object):
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
hist
,
bin_edges
=
np
.
histogram
(
values
,
bins
=
buckets
)
walltime
=
round
(
time
.
time
())
if
walltime
is
None
else
walltime
walltime
=
round
(
time
.
time
()
*
1000
)
if
walltime
is
None
else
walltime
self
.
_get_file_writer
().
add_record
(
histogram
(
tag
=
tag
,
...
...
@@ -338,7 +338,7 @@ class LogWriter(object):
"""
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
walltime
=
round
(
time
.
time
())
if
walltime
is
None
else
walltime
walltime
=
round
(
time
.
time
()
*
1000
)
if
walltime
is
None
else
walltime
self
.
_get_file_writer
().
add_record
(
pr_curve
(
tag
=
tag
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录