Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
a1176e55
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a1176e55
编写于
1月 16, 2018
作者:
Y
Yan Chunwei
提交者:
daminglu
1月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Feature/fix online scratch (#160)
上级
9a5a3bc9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
6 deletion
+25
-6
demo/vdl_scratch.py
demo/vdl_scratch.py
+24
-4
visualdl/server/visualDL
visualdl/server/visualDL
+1
-2
未找到文件。
demo/vdl_scratch.py
浏览文件 @
a1176e55
...
...
@@ -32,24 +32,34 @@ for step in range(1, 100):
# create histogram
with
logw
.
mode
(
'train'
)
as
logger
:
histogram
=
logger
.
histogram
(
"scratch/histogram"
,
num_buckets
=
200
)
histogram0
=
logger
.
histogram
(
"scratch/histogram0"
,
num_buckets
=
200
)
for
step
in
range
(
1
,
100
):
histogram
.
add_record
(
step
,
np
.
random
.
normal
(
0.1
+
step
*
0.001
,
200.
/
(
100
+
step
),
size
=
1000
))
for
step
in
range
(
1
,
50
):
histogram0
.
add_record
(
step
,
np
.
random
.
normal
(
0.1
+
step
*
0.003
,
200.
/
(
120
+
step
),
size
=
1000
))
# create image
with
logw
.
mode
(
"train"
)
as
logger
:
image
=
logger
.
image
(
"scratch/dog"
,
4
,
1
)
# randomly sample 4 images one pass
image
=
logger
.
image
(
"scratch/dog"
,
4
)
# randomly sample 4 images one pass
image0
=
logger
.
image
(
"scratch/random"
,
4
)
dog_jpg
=
Image
.
open
(
os
.
path
.
join
(
ROOT
,
'python/dog.jpg'
))
dog_jpg
=
dog_jpg
.
resize
(
np
.
array
(
dog_jpg
.
size
)
/
2
)
shape
=
[
dog_jpg
.
size
[
1
],
dog_jpg
.
size
[
0
],
3
]
# add dog's image
for
pass_
in
xrange
(
4
):
image
.
start_sampling
()
for
sample
in
xrange
(
10
):
# randomly crop a d
emo
image.
# randomly crop a d
og's
image.
target_shape
=
[
100
,
100
,
3
]
# width, height, channels(3 for RGB)
left_x
=
random
.
randint
(
0
,
shape
[
1
]
-
target_shape
[
1
])
left_y
=
random
.
randint
(
0
,
shape
[
0
]
-
target_shape
[
0
])
...
...
@@ -57,7 +67,8 @@ with logw.mode("train") as logger:
right_y
=
left_y
+
target_shape
[
0
]
# a more efficient way to sample images
idx
=
image
.
is_sample_taken
()
# check whether this image will be taken by reservoir sampling
# check whether this image will be taken by reservoir sampling
idx
=
image
.
is_sample_taken
()
if
idx
>=
0
:
data
=
np
.
array
(
dog_jpg
.
crop
((
left_x
,
left_y
,
right_x
,
...
...
@@ -72,3 +83,12 @@ with logw.mode("train") as logger:
# image.add_sample(shape, data)
image
.
finish_sampling
()
# add randomly generated image
for
pass_
in
xrange
(
4
):
image0
.
start_sampling
()
for
sample
in
xrange
(
10
):
shape
=
[
40
,
30
,
3
]
data
=
np
.
random
.
random
(
shape
).
flatten
()
image0
.
add_sample
(
shape
,
list
(
data
))
image0
.
finish_sampling
()
visualdl/server/visualDL
浏览文件 @
a1176e55
...
...
@@ -109,14 +109,13 @@ def index():
@
app
.
route
(
'/static/<path:filename>'
)
def
serve_static
(
filename
):
print
'serve static '
,
filename
return
send_from_directory
(
os
.
path
.
join
(
server_path
,
static_file_path
),
filename
)
@
app
.
route
(
'/graphs/image'
)
def
serve_graph
():
return
send_file
(
graph_image_path
)
return
send_file
(
os
.
path
.
join
(
os
.
getcwd
(),
graph_image_path
)
)
@
app
.
route
(
'/data/logdir'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录