Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
dd02ed4a
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看板
提交
dd02ed4a
编写于
12月 28, 2017
作者:
S
superjom
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/add_image_component-debug_image' into feature/add_image_component
上级
de17756b
bb271f1d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
65 addition
and
9 deletion
+65
-9
server/visualdl/lib.py
server/visualdl/lib.py
+5
-3
server/visualdl/lib_test.py
server/visualdl/lib_test.py
+51
-0
server/visualdl/mock.sh
server/visualdl/mock.sh
+1
-1
server/visualdl/storage_mock.py
server/visualdl/storage_mock.py
+2
-1
server/visualdl/visual_dl.py
server/visualdl/visual_dl.py
+1
-1
tests.sh
tests.sh
+2
-0
visualdl/logic/sdk.cc
visualdl/logic/sdk.cc
+3
-3
未找到文件。
server/visualdl/lib.py
浏览文件 @
dd02ed4a
...
@@ -51,9 +51,9 @@ def get_image_tags(storage):
...
@@ -51,9 +51,9 @@ def get_image_tags(storage):
for
tag
in
tags
:
for
tag
in
tags
:
image
=
reader
.
image
(
tag
)
image
=
reader
.
image
(
tag
)
for
i
in
xrange
(
max
(
1
,
image
.
num_samples
())):
for
i
in
xrange
(
max
(
1
,
image
.
num_samples
())):
tag
=
image
.
caption
()
if
image
.
num_samples
()
<=
1
else
'%s/%d'
%
(
tag
,
i
)
caption
=
tag
if
image
.
num_samples
()
<=
1
else
'%s/%d'
%
(
tag
,
i
)
result
[
mode
][
tag
]
=
{
result
[
mode
][
caption
]
=
{
'displayName'
:
tag
,
'displayName'
:
caption
,
'description'
:
""
,
'description'
:
""
,
'samples'
:
1
,
'samples'
:
1
,
}
}
...
@@ -61,6 +61,7 @@ def get_image_tags(storage):
...
@@ -61,6 +61,7 @@ def get_image_tags(storage):
def
get_image_tag_steps
(
storage
,
mode
,
tag
):
def
get_image_tag_steps
(
storage
,
mode
,
tag
):
print
'image_tag_steps,mode,tag:'
,
mode
,
tag
# remove suffix '/x'
# remove suffix '/x'
res
=
re
.
search
(
r
".*/([0-9]+$)"
,
tag
)
res
=
re
.
search
(
r
".*/([0-9]+$)"
,
tag
)
sample_index
=
0
sample_index
=
0
...
@@ -76,6 +77,7 @@ def get_image_tag_steps(storage, mode, tag):
...
@@ -76,6 +77,7 @@ def get_image_tag_steps(storage, mode, tag):
for
step_index
in
range
(
image
.
num_records
()):
for
step_index
in
range
(
image
.
num_records
()):
record
=
image
.
record
(
step_index
,
sample_index
)
record
=
image
.
record
(
step_index
,
sample_index
)
shape
=
record
.
shape
()
shape
=
record
.
shape
()
assert
shape
,
"%s,%s"
%
(
mode
,
tag
)
query
=
urllib
.
urlencode
({
query
=
urllib
.
urlencode
({
'sample'
:
0
,
'sample'
:
0
,
'index'
:
step_index
,
'index'
:
step_index
,
...
...
server/visualdl/lib_test.py
0 → 100644
浏览文件 @
dd02ed4a
import
lib
import
unittest
import
storage
import
pprint
from
storage_mock
import
add_scalar
,
add_image
class
LibTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
dir
=
"./tmp/mock"
writer
=
storage
.
StorageWriter
(
dir
,
sync_cycle
=
20
)
add_scalar
(
writer
,
"train"
,
"layer/scalar0/min"
,
1000
,
1
)
add_scalar
(
writer
,
"test"
,
"layer/scalar0/min"
,
1000
,
10
)
add_scalar
(
writer
,
"valid"
,
"layer/scalar0/min"
,
1000
,
10
)
add_scalar
(
writer
,
"train"
,
"layer/scalar0/max"
,
1000
,
1
)
add_scalar
(
writer
,
"test"
,
"layer/scalar0/max"
,
1000
,
10
)
add_scalar
(
writer
,
"valid"
,
"layer/scalar0/max"
,
1000
,
10
)
add_image
(
writer
,
"train"
,
"layer/image0"
,
7
,
10
,
1
)
add_image
(
writer
,
"test"
,
"layer/image0"
,
7
,
10
,
3
)
self
.
reader
=
storage
.
StorageReader
(
dir
)
def
test_modes
(
self
):
modes
=
lib
.
get_modes
(
self
.
reader
)
self
.
assertEqual
(
sorted
(
modes
),
sorted
([
"train"
,
"test"
,
"valid"
]))
def
test_scalar
(
self
):
for
mode
in
"train test valid"
.
split
():
tags
=
lib
.
get_scalar_tags
(
self
.
reader
,
mode
)
print
'scalar tags:'
pprint
.
pprint
(
tags
)
self
.
assertEqual
(
len
(
tags
),
3
)
self
.
assertEqual
(
sorted
(
tags
.
keys
()),
sorted
(
"train test valid"
.
split
()))
def
test_image
(
self
):
tags
=
lib
.
get_image_tags
(
self
.
reader
)
self
.
assertEqual
(
len
(
tags
),
2
)
tags
=
lib
.
get_image_tag_steps
(
self
.
reader
,
'train'
,
'layer/image0/0'
)
pprint
.
pprint
(
tags
)
image
=
lib
.
get_invididual_image
(
self
.
reader
,
"train"
,
'layer/image0/0'
,
2
)
print
image
if
__name__
==
'__main__'
:
unittest
.
main
()
server/visualdl/mock.sh
浏览文件 @
dd02ed4a
...
@@ -3,4 +3,4 @@ set -ex
...
@@ -3,4 +3,4 @@ set -ex
export
PYTHONPATH
=
"/home/superjom/project/VisualDL/build/visualdl/logic:/home/superjom/project/VisualDL/visualdl/python"
export
PYTHONPATH
=
"/home/superjom/project/VisualDL/build/visualdl/logic:/home/superjom/project/VisualDL/visualdl/python"
python
storage_mock
.py
python
lib_test
.py
server/visualdl/storage_mock.py
浏览文件 @
dd02ed4a
...
@@ -26,11 +26,12 @@ def add_image(writer,
...
@@ -26,11 +26,12 @@ def add_image(writer,
for
pass_
in
xrange
(
num_passes
):
for
pass_
in
xrange
(
num_passes
):
image_writer
.
start_sampling
()
image_writer
.
start_sampling
()
for
ins
in
xrange
(
2
*
num_samples
):
for
ins
in
xrange
(
2
*
num_samples
):
print
'.'
,
index
=
image_writer
.
is_sample_taken
()
index
=
image_writer
.
is_sample_taken
()
if
index
!=
-
1
:
if
index
!=
-
1
:
data
=
np
.
random
.
random
(
shape
)
*
256
data
=
np
.
random
.
random
(
shape
)
*
256
data
=
np
.
ndarray
.
flatten
(
data
)
data
=
np
.
ndarray
.
flatten
(
data
)
assert
shape
assert
len
(
data
)
>
0
image_writer
.
set_sample
(
index
,
shape
,
list
(
data
))
image_writer
.
set_sample
(
index
,
shape
,
list
(
data
))
image_writer
.
finish_sampling
()
image_writer
.
finish_sampling
()
...
...
server/visualdl/visual_dl.py
浏览文件 @
dd02ed4a
...
@@ -89,7 +89,7 @@ def logdir():
...
@@ -89,7 +89,7 @@ def logdir():
@
app
.
route
(
'/data/runs'
)
@
app
.
route
(
'/data/runs'
)
def
runs
():
def
runs
():
modes
=
storage
.
modes
()
modes
=
storage
.
modes
()
result
=
gen_result
(
0
,
""
,
lib
.
modes
())
result
=
gen_result
(
0
,
""
,
lib
.
get_
modes
())
return
Response
(
json
.
dumps
(
result
),
mimetype
=
'application/json'
)
return
Response
(
json
.
dumps
(
result
),
mimetype
=
'application/json'
)
...
...
tests.sh
浏览文件 @
dd02ed4a
...
@@ -26,6 +26,8 @@ frontend_test() {
...
@@ -26,6 +26,8 @@ frontend_test() {
}
}
server_test
()
{
server_test
()
{
cd
$cur
/server
bash build.sh
cd
$cur
/server/visualdl
cd
$cur
/server/visualdl
python lib_test.py
python lib_test.py
}
}
...
...
visualdl/logic/sdk.cc
浏览文件 @
dd02ed4a
...
@@ -48,9 +48,8 @@ template class ScalarReader<float>;
...
@@ -48,9 +48,8 @@ template class ScalarReader<float>;
template
class
ScalarReader
<
double
>;
template
class
ScalarReader
<
double
>;
void
Image
::
StartSampling
()
{
void
Image
::
StartSampling
()
{
// TODO(ChunweiYan) big bug here, every step will be stored in protobuf
if
(
!
ToSampleThisStep
())
return
;
// and that might result in explosion in some scenerios, Just sampling
// some steps should be better.
step_
=
writer_
.
AddRecord
();
step_
=
writer_
.
AddRecord
();
step_
.
SetId
(
step_id_
);
step_
.
SetId
(
step_id_
);
...
@@ -103,6 +102,7 @@ void Image::SetSample(int index,
...
@@ -103,6 +102,7 @@ void Image::SetSample(int index,
// production
// production
int
size
=
std
::
accumulate
(
int
size
=
std
::
accumulate
(
shape
.
begin
(),
shape
.
end
(),
1.
,
[](
float
a
,
float
b
)
{
return
a
*
b
;
});
shape
.
begin
(),
shape
.
end
(),
1.
,
[](
float
a
,
float
b
)
{
return
a
*
b
;
});
CHECK_GT
(
size
,
0
);
CHECK_EQ
(
size
,
data
.
size
())
<<
"image's shape not match data"
;
CHECK_EQ
(
size
,
data
.
size
())
<<
"image's shape not match data"
;
CHECK_LT
(
index
,
num_samples_
);
CHECK_LT
(
index
,
num_samples_
);
CHECK_LE
(
index
,
num_records_
);
CHECK_LE
(
index
,
num_records_
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录