Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
065b615a
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 2 年 前同步成功
通知
89
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看板
提交
065b615a
编写于
1月 04, 2018
作者:
Y
Yan Chunwei
提交者:
GitHub
1月 04, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change scalar from random sample to equidistant sampling (#57)
上级
de9d1346
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
11 addition
and
5 deletion
+11
-5
server/visualdl/lib.py
server/visualdl/lib.py
+11
-5
未找到文件。
server/visualdl/lib.py
浏览文件 @
065b615a
...
...
@@ -29,7 +29,7 @@ def get_scalar_tags(storage, mode):
return
result
def
get_scalar
(
storage
,
mode
,
tag
,
num_records
=
1
00
):
def
get_scalar
(
storage
,
mode
,
tag
,
num_records
=
3
00
):
with
storage
.
mode
(
mode
)
as
reader
:
scalar
=
reader
.
scalar
(
tag
)
...
...
@@ -41,8 +41,13 @@ def get_scalar(storage, mode, tag, num_records=100):
if
len
(
data
)
<=
num_records
:
return
data
samples
=
sorted
(
random
.
sample
(
xrange
(
len
(
data
)),
num_records
))
return
[
data
[
i
]
for
i
in
samples
]
span
=
float
(
len
(
data
)
/
num_records
)
end_idx
=
len
(
data
)
-
1
res
=
[]
for
i
in
xrange
(
num_records
):
id
=
int
(
end_idx
-
i
*
span
)
res
.
append
(
data
[
id
])
return
[
v
for
v
in
reversed
(
res
)]
def
get_image_tags
(
storage
):
...
...
@@ -56,7 +61,8 @@ def get_image_tags(storage):
for
tag
in
tags
:
image
=
reader
.
image
(
tag
)
for
i
in
xrange
(
max
(
1
,
image
.
num_samples
())):
caption
=
tag
if
image
.
num_samples
()
<=
1
else
'%s/%d'
%
(
tag
,
i
)
caption
=
tag
if
image
.
num_samples
(
)
<=
1
else
'%s/%d'
%
(
tag
,
i
)
result
[
mode
][
caption
]
=
{
'displayName'
:
caption
,
'description'
:
""
,
...
...
@@ -120,7 +126,7 @@ def get_invididual_image(storage, mode, tag, step_index, max_size=80):
size
=
max
(
shape
[
0
],
shape
[
1
])
if
size
>
max_size
:
scale
=
max_size
*
1.
/
size
scaled_shape
=
(
int
(
shape
[
0
]
*
scale
),
int
(
shape
[
1
]
*
scale
))
scaled_shape
=
(
int
(
shape
[
0
]
*
scale
),
int
(
shape
[
1
]
*
scale
))
im
=
im
.
resize
(
scaled_shape
)
im
.
save
(
tempfile
)
tempfile
.
seek
(
0
,
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录