Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
f883251f
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看板
未验证
提交
f883251f
编写于
1月 26, 2021
作者:
走神的阿圆
提交者:
GitHub
1月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add text
上级
f1c4a3ae
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
162 addition
and
24 deletion
+162
-24
visualdl/component/__init__.py
visualdl/component/__init__.py
+3
-0
visualdl/component/base_component.py
visualdl/component/base_component.py
+16
-0
visualdl/proto/record.proto
visualdl/proto/record.proto
+5
-0
visualdl/proto/record_pb2.py
visualdl/proto/record_pb2.py
+71
-21
visualdl/reader/reader.py
visualdl/reader/reader.py
+2
-0
visualdl/server/api.py
visualdl/server/api.py
+18
-0
visualdl/server/data_manager.py
visualdl/server/data_manager.py
+5
-2
visualdl/server/lib.py
visualdl/server/lib.py
+20
-0
visualdl/writer/writer.py
visualdl/writer/writer.py
+22
-1
未找到文件。
visualdl/component/__init__.py
浏览文件 @
f883251f
...
@@ -20,6 +20,9 @@ components = {
...
@@ -20,6 +20,9 @@ components = {
"image"
:
{
"image"
:
{
"enabled"
:
False
"enabled"
:
False
},
},
"text"
:
{
"enabled"
:
False
},
"embedding"
:
{
"embedding"
:
{
"enabled"
:
False
"enabled"
:
False
},
},
...
...
visualdl/component/base_component.py
浏览文件 @
f883251f
...
@@ -257,6 +257,22 @@ def audio(tag, audio_array, sample_rate, step, walltime):
...
@@ -257,6 +257,22 @@ def audio(tag, audio_array, sample_rate, step, walltime):
])
])
def
text
(
tag
,
text_string
,
step
,
walltime
=
None
):
"""Package data to one image.
Args:
tag (string): Data identifier
text_string (string): Value of text
step (int): Step of text
walltime (int): Wall time of text
Return:
Package with format of record_pb2.Record
"""
_text
=
Record
.
Text
(
encoded_text_string
=
text_string
)
return
Record
(
values
=
[
Record
.
Value
(
id
=
step
,
tag
=
tag
,
timestamp
=
walltime
,
text
=
_text
)
])
def
histogram
(
tag
,
hist
,
bin_edges
,
step
,
walltime
):
def
histogram
(
tag
,
hist
,
bin_edges
,
step
,
walltime
):
"""Package data to one histogram.
"""Package data to one histogram.
...
...
visualdl/proto/record.proto
浏览文件 @
f883251f
...
@@ -7,6 +7,10 @@ message Record {
...
@@ -7,6 +7,10 @@ message Record {
bytes
encoded_image_string
=
4
;
bytes
encoded_image_string
=
4
;
}
}
message
Text
{
string
encoded_text_string
=
1
;
}
message
Audio
{
message
Audio
{
float
sample_rate
=
1
;
float
sample_rate
=
1
;
int64
num_channels
=
2
;
int64
num_channels
=
2
;
...
@@ -70,6 +74,7 @@ message Record {
...
@@ -70,6 +74,7 @@ message Record {
PRCurve
pr_curve
=
9
;
PRCurve
pr_curve
=
9
;
MetaData
meta_data
=
10
;
MetaData
meta_data
=
10
;
ROC_Curve
roc_curve
=
11
;
ROC_Curve
roc_curve
=
11
;
Text
text
=
12
;
}
}
}
}
...
...
visualdl/proto/record_pb2.py
浏览文件 @
f883251f
...
@@ -18,7 +18,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
...
@@ -18,7 +18,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package
=
'visualdl'
,
package
=
'visualdl'
,
syntax
=
'proto3'
,
syntax
=
'proto3'
,
serialized_options
=
None
,
serialized_options
=
None
,
serialized_pb
=
b
'
\n\x0c
record.proto
\x12\x08
visualdl
\"\x
e0\x08\n\x06
Record
\x12
&
\n\x06
values
\x18\x01
\x03
(
\x0b\x32\x16
.visualdl.Record.Value
\x1a
%
\n\x05
Image
\x12\x1c\n\x14\x65
ncoded_image_string
\x18\x04
\x01
(
\x0c\x1a
}
\n\x05\x41
udio
\x12\x13\n\x0b
sample_rate
\x18\x01
\x01
(
\x02\x12\x14\n\x0c
num_channels
\x18\x02
\x01
(
\x03\x12\x15\n\r
length_frames
\x18\x03
\x01
(
\x03\x12\x1c\n\x14\x65
ncoded_audio_string
\x18\x04
\x01
(
\x0c\x12\x14\n\x0c\x63
ontent_type
\x18\x05
\x01
(
\t\x1a
+
\n\t
Embedding
\x12\r\n\x05
label
\x18\x01
\x03
(
\t\x12\x0f\n\x07
vectors
\x18\x02
\x03
(
\x02\x1a
P
\n\n
Embeddings
\x12
.
\n\n
embeddings
\x18\x01
\x03
(
\x0b\x32\x1a
.visualdl.Record.Embedding
\x12\x12\n\n
label_meta
\x18\x02
\x03
(
\t\x1a\x43\n\x10\x62
ytes_embeddings
\x12\x16\n\x0e\x65
ncoded_labels
\x18\x01
\x01
(
\x0c\x12\x17\n\x0f\x65
ncoded_vectors
\x18\x02
\x01
(
\x0c\x1a\x34\n\t
Histogram
\x12\x10\n\x04
hist
\x18\x01
\x03
(
\x01\x42\x02\x10\x01\x12\x15\n\t
bin_edges
\x18\x02
\x03
(
\x01\x42\x02\x10\x01\x1a
l
\n\x07
PRCurve
\x12\x0e\n\x02
TP
\x18\x01
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02\x46
P
\x18\x02
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02
TN
\x18\x03
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02\x46
N
\x18\x04
\x03
(
\x03\x42\x02\x10\x01\x12\x11\n\t
precision
\x18\x05
\x03
(
\x01\x12\x0e\n\x06
recall
\x18\x06
\x03
(
\x01\x1a\x65\n\t
ROC_Curve
\x12\x0e\n\x02
TP
\x18\x01
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02\x46
P
\x18\x02
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02
TN
\x18\x03
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02\x46
N
\x18\x04
\x03
(
\x03\x42\x02\x10\x01\x12\x0b\n\x03
tpr
\x18\x05
\x03
(
\x01\x12\x0b\n\x03\x66
pr
\x18\x06
\x03
(
\x01\x1a
\n\x08
MetaData
\x12\x14\n\x0c\x64
isplay_name
\x18\x01
\x01
(
\t\x1a\x96\x03\n\x05
Value
\x12\n\n\x02
id
\x18\x01
\x01
(
\x03\x12\x0b\n\x03
tag
\x18\x02
\x01
(
\t\x12\x11\n\t
timestamp
\x18\x03
\x01
(
\x03\x12\x0f\n\x05
value
\x18\x04
\x01
(
\x02
H
\x00\x12\'\n\x05
image
\x18\x05
\x01
(
\x0b\x32\x16
.visualdl.Record.ImageH
\x00\x12\'\n\x05\x61
udio
\x18\x06
\x01
(
\x0b\x32\x16
.visualdl.Record.AudioH
\x00\x12\x31\n\n
embeddings
\x18\x07
\x01
(
\x0b\x32\x1b
.visualdl.Record.EmbeddingsH
\x00\x12
/
\n\t
histogram
\x18\x08
\x01
(
\x0b\x32\x1a
.visualdl.Record.HistogramH
\x00\x12
,
\n\x08
pr_curve
\x18\t
\x01
(
\x0b\x32\x18
.visualdl.Record.PRCurveH
\x00\x12
.
\n\t
meta_data
\x18\n
\x01
(
\x0b\x32\x19
.visualdl.Record.MetaDataH
\x00\x12
/
\n\t
roc_curve
\x18\x0b
\x01
(
\x0b\x32\x1a
.visualdl.Record.ROC_Curve
H
\x00\x42\x0b\n\t
one_valueb
\x06
proto3'
serialized_pb
=
b
'
\n\x0c
record.proto
\x12\x08
visualdl
\"\x
ac\t\n\x06
Record
\x12
&
\n\x06
values
\x18\x01
\x03
(
\x0b\x32\x16
.visualdl.Record.Value
\x1a
%
\n\x05
Image
\x12\x1c\n\x14\x65
ncoded_image_string
\x18\x04
\x01
(
\x0c\x1a
#
\n\x04
Text
\x12\x1b\n\x13\x65
ncoded_text_string
\x18\x01
\x01
(
\t\x1a
}
\n\x05\x41
udio
\x12\x13\n\x0b
sample_rate
\x18\x01
\x01
(
\x02\x12\x14\n\x0c
num_channels
\x18\x02
\x01
(
\x03\x12\x15\n\r
length_frames
\x18\x03
\x01
(
\x03\x12\x1c\n\x14\x65
ncoded_audio_string
\x18\x04
\x01
(
\x0c\x12\x14\n\x0c\x63
ontent_type
\x18\x05
\x01
(
\t\x1a
+
\n\t
Embedding
\x12\r\n\x05
label
\x18\x01
\x03
(
\t\x12\x0f\n\x07
vectors
\x18\x02
\x03
(
\x02\x1a
P
\n\n
Embeddings
\x12
.
\n\n
embeddings
\x18\x01
\x03
(
\x0b\x32\x1a
.visualdl.Record.Embedding
\x12\x12\n\n
label_meta
\x18\x02
\x03
(
\t\x1a\x43\n\x10\x62
ytes_embeddings
\x12\x16\n\x0e\x65
ncoded_labels
\x18\x01
\x01
(
\x0c\x12\x17\n\x0f\x65
ncoded_vectors
\x18\x02
\x01
(
\x0c\x1a\x34\n\t
Histogram
\x12\x10\n\x04
hist
\x18\x01
\x03
(
\x01\x42\x02\x10\x01\x12\x15\n\t
bin_edges
\x18\x02
\x03
(
\x01\x42\x02\x10\x01\x1a
l
\n\x07
PRCurve
\x12\x0e\n\x02
TP
\x18\x01
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02\x46
P
\x18\x02
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02
TN
\x18\x03
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02\x46
N
\x18\x04
\x03
(
\x03\x42\x02\x10\x01\x12\x11\n\t
precision
\x18\x05
\x03
(
\x01\x12\x0e\n\x06
recall
\x18\x06
\x03
(
\x01\x1a\x65\n\t
ROC_Curve
\x12\x0e\n\x02
TP
\x18\x01
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02\x46
P
\x18\x02
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02
TN
\x18\x03
\x03
(
\x03\x42\x02\x10\x01\x12\x0e\n\x02\x46
N
\x18\x04
\x03
(
\x03\x42\x02\x10\x01\x12\x0b\n\x03
tpr
\x18\x05
\x03
(
\x01\x12\x0b\n\x03\x66
pr
\x18\x06
\x03
(
\x01\x1a
\n\x08
MetaData
\x12\x14\n\x0c\x64
isplay_name
\x18\x01
\x01
(
\t\x1a\xbd\x03\n\x05
Value
\x12\n\n\x02
id
\x18\x01
\x01
(
\x03\x12\x0b\n\x03
tag
\x18\x02
\x01
(
\t\x12\x11\n\t
timestamp
\x18\x03
\x01
(
\x03\x12\x0f\n\x05
value
\x18\x04
\x01
(
\x02
H
\x00\x12\'\n\x05
image
\x18\x05
\x01
(
\x0b\x32\x16
.visualdl.Record.ImageH
\x00\x12\'\n\x05\x61
udio
\x18\x06
\x01
(
\x0b\x32\x16
.visualdl.Record.AudioH
\x00\x12\x31\n\n
embeddings
\x18\x07
\x01
(
\x0b\x32\x1b
.visualdl.Record.EmbeddingsH
\x00\x12
/
\n\t
histogram
\x18\x08
\x01
(
\x0b\x32\x1a
.visualdl.Record.HistogramH
\x00\x12
,
\n\x08
pr_curve
\x18\t
\x01
(
\x0b\x32\x18
.visualdl.Record.PRCurveH
\x00\x12
.
\n\t
meta_data
\x18\n
\x01
(
\x0b\x32\x19
.visualdl.Record.MetaDataH
\x00\x12
/
\n\t
roc_curve
\x18\x0b
\x01
(
\x0b\x32\x1a
.visualdl.Record.ROC_CurveH
\x00\x12
%
\n\x04
text
\x18\x0c
\x01
(
\x0b\x32\x15
.visualdl.Record.Text
H
\x00\x42\x0b\n\t
one_valueb
\x06
proto3'
)
)
...
@@ -54,6 +54,36 @@ _RECORD_IMAGE = _descriptor.Descriptor(
...
@@ -54,6 +54,36 @@ _RECORD_IMAGE = _descriptor.Descriptor(
serialized_end
=
114
,
serialized_end
=
114
,
)
)
_RECORD_TEXT
=
_descriptor
.
Descriptor
(
name
=
'Text'
,
full_name
=
'visualdl.Record.Text'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'encoded_text_string'
,
full_name
=
'visualdl.Record.Text.encoded_text_string'
,
index
=
0
,
number
=
1
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
b
""
.
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
],
serialized_options
=
None
,
is_extendable
=
False
,
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
116
,
serialized_end
=
151
,
)
_RECORD_AUDIO
=
_descriptor
.
Descriptor
(
_RECORD_AUDIO
=
_descriptor
.
Descriptor
(
name
=
'Audio'
,
name
=
'Audio'
,
full_name
=
'visualdl.Record.Audio'
,
full_name
=
'visualdl.Record.Audio'
,
...
@@ -108,8 +138,8 @@ _RECORD_AUDIO = _descriptor.Descriptor(
...
@@ -108,8 +138,8 @@ _RECORD_AUDIO = _descriptor.Descriptor(
extension_ranges
=
[],
extension_ranges
=
[],
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
1
16
,
serialized_start
=
1
53
,
serialized_end
=
2
41
,
serialized_end
=
2
78
,
)
)
_RECORD_EMBEDDING
=
_descriptor
.
Descriptor
(
_RECORD_EMBEDDING
=
_descriptor
.
Descriptor
(
...
@@ -145,8 +175,8 @@ _RECORD_EMBEDDING = _descriptor.Descriptor(
...
@@ -145,8 +175,8 @@ _RECORD_EMBEDDING = _descriptor.Descriptor(
extension_ranges
=
[],
extension_ranges
=
[],
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
2
43
,
serialized_start
=
2
80
,
serialized_end
=
286
,
serialized_end
=
323
,
)
)
_RECORD_EMBEDDINGS
=
_descriptor
.
Descriptor
(
_RECORD_EMBEDDINGS
=
_descriptor
.
Descriptor
(
...
@@ -182,8 +212,8 @@ _RECORD_EMBEDDINGS = _descriptor.Descriptor(
...
@@ -182,8 +212,8 @@ _RECORD_EMBEDDINGS = _descriptor.Descriptor(
extension_ranges
=
[],
extension_ranges
=
[],
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
288
,
serialized_start
=
325
,
serialized_end
=
368
,
serialized_end
=
405
,
)
)
_RECORD_BYTES_EMBEDDINGS
=
_descriptor
.
Descriptor
(
_RECORD_BYTES_EMBEDDINGS
=
_descriptor
.
Descriptor
(
...
@@ -219,8 +249,8 @@ _RECORD_BYTES_EMBEDDINGS = _descriptor.Descriptor(
...
@@ -219,8 +249,8 @@ _RECORD_BYTES_EMBEDDINGS = _descriptor.Descriptor(
extension_ranges
=
[],
extension_ranges
=
[],
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
370
,
serialized_start
=
407
,
serialized_end
=
4
37
,
serialized_end
=
4
74
,
)
)
_RECORD_HISTOGRAM
=
_descriptor
.
Descriptor
(
_RECORD_HISTOGRAM
=
_descriptor
.
Descriptor
(
...
@@ -256,8 +286,8 @@ _RECORD_HISTOGRAM = _descriptor.Descriptor(
...
@@ -256,8 +286,8 @@ _RECORD_HISTOGRAM = _descriptor.Descriptor(
extension_ranges
=
[],
extension_ranges
=
[],
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
4
39
,
serialized_start
=
4
76
,
serialized_end
=
491
,
serialized_end
=
528
,
)
)
_RECORD_PRCURVE
=
_descriptor
.
Descriptor
(
_RECORD_PRCURVE
=
_descriptor
.
Descriptor
(
...
@@ -321,8 +351,8 @@ _RECORD_PRCURVE = _descriptor.Descriptor(
...
@@ -321,8 +351,8 @@ _RECORD_PRCURVE = _descriptor.Descriptor(
extension_ranges
=
[],
extension_ranges
=
[],
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
493
,
serialized_start
=
530
,
serialized_end
=
6
01
,
serialized_end
=
6
38
,
)
)
_RECORD_ROC_CURVE
=
_descriptor
.
Descriptor
(
_RECORD_ROC_CURVE
=
_descriptor
.
Descriptor
(
...
@@ -386,8 +416,8 @@ _RECORD_ROC_CURVE = _descriptor.Descriptor(
...
@@ -386,8 +416,8 @@ _RECORD_ROC_CURVE = _descriptor.Descriptor(
extension_ranges
=
[],
extension_ranges
=
[],
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
6
03
,
serialized_start
=
6
40
,
serialized_end
=
7
04
,
serialized_end
=
7
41
,
)
)
_RECORD_METADATA
=
_descriptor
.
Descriptor
(
_RECORD_METADATA
=
_descriptor
.
Descriptor
(
...
@@ -416,8 +446,8 @@ _RECORD_METADATA = _descriptor.Descriptor(
...
@@ -416,8 +446,8 @@ _RECORD_METADATA = _descriptor.Descriptor(
extension_ranges
=
[],
extension_ranges
=
[],
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
7
06
,
serialized_start
=
7
43
,
serialized_end
=
7
38
,
serialized_end
=
7
75
,
)
)
_RECORD_VALUE
=
_descriptor
.
Descriptor
(
_RECORD_VALUE
=
_descriptor
.
Descriptor
(
...
@@ -504,6 +534,13 @@ _RECORD_VALUE = _descriptor.Descriptor(
...
@@ -504,6 +534,13 @@ _RECORD_VALUE = _descriptor.Descriptor(
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
serialized_options
=
None
,
file
=
DESCRIPTOR
),
_descriptor
.
FieldDescriptor
(
name
=
'text'
,
full_name
=
'visualdl.Record.Value.text'
,
index
=
11
,
number
=
12
,
type
=
11
,
cpp_type
=
10
,
label
=
1
,
has_default_value
=
False
,
default_value
=
None
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
],
],
extensions
=
[
extensions
=
[
],
],
...
@@ -519,8 +556,8 @@ _RECORD_VALUE = _descriptor.Descriptor(
...
@@ -519,8 +556,8 @@ _RECORD_VALUE = _descriptor.Descriptor(
name
=
'one_value'
,
full_name
=
'visualdl.Record.Value.one_value'
,
name
=
'one_value'
,
full_name
=
'visualdl.Record.Value.one_value'
,
index
=
0
,
containing_type
=
None
,
fields
=
[]),
index
=
0
,
containing_type
=
None
,
fields
=
[]),
],
],
serialized_start
=
7
41
,
serialized_start
=
7
78
,
serialized_end
=
1
147
,
serialized_end
=
1
223
,
)
)
_RECORD
=
_descriptor
.
Descriptor
(
_RECORD
=
_descriptor
.
Descriptor
(
...
@@ -540,7 +577,7 @@ _RECORD = _descriptor.Descriptor(
...
@@ -540,7 +577,7 @@ _RECORD = _descriptor.Descriptor(
],
],
extensions
=
[
extensions
=
[
],
],
nested_types
=
[
_RECORD_IMAGE
,
_RECORD_AUDIO
,
_RECORD_EMBEDDING
,
_RECORD_EMBEDDINGS
,
_RECORD_BYTES_EMBEDDINGS
,
_RECORD_HISTOGRAM
,
_RECORD_PRCURVE
,
_RECORD_ROC_CURVE
,
_RECORD_METADATA
,
_RECORD_VALUE
,
],
nested_types
=
[
_RECORD_IMAGE
,
_RECORD_
TEXT
,
_RECORD_
AUDIO
,
_RECORD_EMBEDDING
,
_RECORD_EMBEDDINGS
,
_RECORD_BYTES_EMBEDDINGS
,
_RECORD_HISTOGRAM
,
_RECORD_PRCURVE
,
_RECORD_ROC_CURVE
,
_RECORD_METADATA
,
_RECORD_VALUE
,
],
enum_types
=
[
enum_types
=
[
],
],
serialized_options
=
None
,
serialized_options
=
None
,
...
@@ -550,10 +587,11 @@ _RECORD = _descriptor.Descriptor(
...
@@ -550,10 +587,11 @@ _RECORD = _descriptor.Descriptor(
oneofs
=
[
oneofs
=
[
],
],
serialized_start
=
27
,
serialized_start
=
27
,
serialized_end
=
1
147
,
serialized_end
=
1
223
,
)
)
_RECORD_IMAGE
.
containing_type
=
_RECORD
_RECORD_IMAGE
.
containing_type
=
_RECORD
_RECORD_TEXT
.
containing_type
=
_RECORD
_RECORD_AUDIO
.
containing_type
=
_RECORD
_RECORD_AUDIO
.
containing_type
=
_RECORD
_RECORD_EMBEDDING
.
containing_type
=
_RECORD
_RECORD_EMBEDDING
.
containing_type
=
_RECORD
_RECORD_EMBEDDINGS
.
fields_by_name
[
'embeddings'
].
message_type
=
_RECORD_EMBEDDING
_RECORD_EMBEDDINGS
.
fields_by_name
[
'embeddings'
].
message_type
=
_RECORD_EMBEDDING
...
@@ -570,6 +608,7 @@ _RECORD_VALUE.fields_by_name['histogram'].message_type = _RECORD_HISTOGRAM
...
@@ -570,6 +608,7 @@ _RECORD_VALUE.fields_by_name['histogram'].message_type = _RECORD_HISTOGRAM
_RECORD_VALUE
.
fields_by_name
[
'pr_curve'
].
message_type
=
_RECORD_PRCURVE
_RECORD_VALUE
.
fields_by_name
[
'pr_curve'
].
message_type
=
_RECORD_PRCURVE
_RECORD_VALUE
.
fields_by_name
[
'meta_data'
].
message_type
=
_RECORD_METADATA
_RECORD_VALUE
.
fields_by_name
[
'meta_data'
].
message_type
=
_RECORD_METADATA
_RECORD_VALUE
.
fields_by_name
[
'roc_curve'
].
message_type
=
_RECORD_ROC_CURVE
_RECORD_VALUE
.
fields_by_name
[
'roc_curve'
].
message_type
=
_RECORD_ROC_CURVE
_RECORD_VALUE
.
fields_by_name
[
'text'
].
message_type
=
_RECORD_TEXT
_RECORD_VALUE
.
containing_type
=
_RECORD
_RECORD_VALUE
.
containing_type
=
_RECORD
_RECORD_VALUE
.
oneofs_by_name
[
'one_value'
].
fields
.
append
(
_RECORD_VALUE
.
oneofs_by_name
[
'one_value'
].
fields
.
append
(
_RECORD_VALUE
.
fields_by_name
[
'value'
])
_RECORD_VALUE
.
fields_by_name
[
'value'
])
...
@@ -595,6 +634,9 @@ _RECORD_VALUE.fields_by_name['meta_data'].containing_oneof = _RECORD_VALUE.oneof
...
@@ -595,6 +634,9 @@ _RECORD_VALUE.fields_by_name['meta_data'].containing_oneof = _RECORD_VALUE.oneof
_RECORD_VALUE
.
oneofs_by_name
[
'one_value'
].
fields
.
append
(
_RECORD_VALUE
.
oneofs_by_name
[
'one_value'
].
fields
.
append
(
_RECORD_VALUE
.
fields_by_name
[
'roc_curve'
])
_RECORD_VALUE
.
fields_by_name
[
'roc_curve'
])
_RECORD_VALUE
.
fields_by_name
[
'roc_curve'
].
containing_oneof
=
_RECORD_VALUE
.
oneofs_by_name
[
'one_value'
]
_RECORD_VALUE
.
fields_by_name
[
'roc_curve'
].
containing_oneof
=
_RECORD_VALUE
.
oneofs_by_name
[
'one_value'
]
_RECORD_VALUE
.
oneofs_by_name
[
'one_value'
].
fields
.
append
(
_RECORD_VALUE
.
fields_by_name
[
'text'
])
_RECORD_VALUE
.
fields_by_name
[
'text'
].
containing_oneof
=
_RECORD_VALUE
.
oneofs_by_name
[
'one_value'
]
_RECORD
.
fields_by_name
[
'values'
].
message_type
=
_RECORD_VALUE
_RECORD
.
fields_by_name
[
'values'
].
message_type
=
_RECORD_VALUE
DESCRIPTOR
.
message_types_by_name
[
'Record'
]
=
_RECORD
DESCRIPTOR
.
message_types_by_name
[
'Record'
]
=
_RECORD
_sym_db
.
RegisterFileDescriptor
(
DESCRIPTOR
)
_sym_db
.
RegisterFileDescriptor
(
DESCRIPTOR
)
...
@@ -608,6 +650,13 @@ Record = _reflection.GeneratedProtocolMessageType('Record', (_message.Message,),
...
@@ -608,6 +650,13 @@ Record = _reflection.GeneratedProtocolMessageType('Record', (_message.Message,),
})
})
,
,
'Text'
:
_reflection
.
GeneratedProtocolMessageType
(
'Text'
,
(
_message
.
Message
,),
{
'DESCRIPTOR'
:
_RECORD_TEXT
,
'__module__'
:
'record_pb2'
# @@protoc_insertion_point(class_scope:visualdl.Record.Text)
})
,
'Audio'
:
_reflection
.
GeneratedProtocolMessageType
(
'Audio'
,
(
_message
.
Message
,),
{
'Audio'
:
_reflection
.
GeneratedProtocolMessageType
(
'Audio'
,
(
_message
.
Message
,),
{
'DESCRIPTOR'
:
_RECORD_AUDIO
,
'DESCRIPTOR'
:
_RECORD_AUDIO
,
'__module__'
:
'record_pb2'
'__module__'
:
'record_pb2'
...
@@ -676,6 +725,7 @@ Record = _reflection.GeneratedProtocolMessageType('Record', (_message.Message,),
...
@@ -676,6 +725,7 @@ Record = _reflection.GeneratedProtocolMessageType('Record', (_message.Message,),
})
})
_sym_db
.
RegisterMessage
(
Record
)
_sym_db
.
RegisterMessage
(
Record
)
_sym_db
.
RegisterMessage
(
Record
.
Image
)
_sym_db
.
RegisterMessage
(
Record
.
Image
)
_sym_db
.
RegisterMessage
(
Record
.
Text
)
_sym_db
.
RegisterMessage
(
Record
.
Audio
)
_sym_db
.
RegisterMessage
(
Record
.
Audio
)
_sym_db
.
RegisterMessage
(
Record
.
Embedding
)
_sym_db
.
RegisterMessage
(
Record
.
Embedding
)
_sym_db
.
RegisterMessage
(
Record
.
Embeddings
)
_sym_db
.
RegisterMessage
(
Record
.
Embeddings
)
...
...
visualdl/reader/reader.py
浏览文件 @
f883251f
...
@@ -180,6 +180,8 @@ class LogReader(object):
...
@@ -180,6 +180,8 @@ class LogReader(object):
elif
"meta_data"
==
value_type
:
elif
"meta_data"
==
value_type
:
self
.
update_meta_data
(
record
)
self
.
update_meta_data
(
record
)
component
=
"meta_data"
component
=
"meta_data"
elif
"text"
==
value_type
:
component
=
"text"
else
:
else
:
raise
TypeError
(
"Invalid value type `%s`."
%
value_type
)
raise
TypeError
(
"Invalid value type `%s`."
%
value_type
)
self
.
_tags
[
path
]
=
component
self
.
_tags
[
path
]
=
component
...
...
visualdl/server/api.py
浏览文件 @
f883251f
...
@@ -101,6 +101,10 @@ class Api(object):
...
@@ -101,6 +101,10 @@ class Api(object):
def
image_tags
(
self
):
def
image_tags
(
self
):
return
self
.
_get_with_retry
(
'data/plugin/images/tags'
,
lib
.
get_image_tags
)
return
self
.
_get_with_retry
(
'data/plugin/images/tags'
,
lib
.
get_image_tags
)
@
result
()
def
text_tags
(
self
):
return
self
.
_get_with_retry
(
'data/plugin/text/tags'
,
lib
.
get_text_tags
)
@
result
()
@
result
()
def
audio_tags
(
self
):
def
audio_tags
(
self
):
return
self
.
_get_with_retry
(
'data/plugin/audio/tags'
,
lib
.
get_audio_tags
)
return
self
.
_get_with_retry
(
'data/plugin/audio/tags'
,
lib
.
get_audio_tags
)
...
@@ -138,6 +142,17 @@ class Api(object):
...
@@ -138,6 +142,17 @@ class Api(object):
key
=
os
.
path
.
join
(
'data/plugin/images/individualImage'
,
mode
,
tag
,
str
(
index
))
key
=
os
.
path
.
join
(
'data/plugin/images/individualImage'
,
mode
,
tag
,
str
(
index
))
return
self
.
_get_with_retry
(
key
,
lib
.
get_individual_image
,
mode
,
tag
,
index
)
return
self
.
_get_with_retry
(
key
,
lib
.
get_individual_image
,
mode
,
tag
,
index
)
@
result
()
def
text_list
(
self
,
mode
,
tag
):
key
=
os
.
path
.
join
(
'data/plugin/text/text'
,
mode
,
tag
)
return
self
.
_get_with_retry
(
key
,
lib
.
get_text_tag_steps
,
mode
,
tag
)
@
result
(
'text/plain'
)
def
text_text
(
self
,
mode
,
tag
,
index
=
0
):
index
=
int
(
index
)
key
=
os
.
path
.
join
(
'data/plugin/text/individualText'
,
mode
,
tag
,
str
(
index
))
return
self
.
_get_with_retry
(
key
,
lib
.
get_individual_text
,
mode
,
tag
,
index
)
@
result
()
@
result
()
def
audio_list
(
self
,
run
,
tag
):
def
audio_list
(
self
,
run
,
tag
):
key
=
os
.
path
.
join
(
'data/plugin/audio/audio'
,
run
,
tag
)
key
=
os
.
path
.
join
(
'data/plugin/audio/audio'
,
run
,
tag
)
...
@@ -216,6 +231,7 @@ def create_api_call(logdir, model, cache_timeout):
...
@@ -216,6 +231,7 @@ def create_api_call(logdir, model, cache_timeout):
'logs'
:
(
api
.
logs
,
[]),
'logs'
:
(
api
.
logs
,
[]),
'scalar/tags'
:
(
api
.
scalar_tags
,
[]),
'scalar/tags'
:
(
api
.
scalar_tags
,
[]),
'image/tags'
:
(
api
.
image_tags
,
[]),
'image/tags'
:
(
api
.
image_tags
,
[]),
'text/tags'
:
(
api
.
text_tags
,
[]),
'audio/tags'
:
(
api
.
audio_tags
,
[]),
'audio/tags'
:
(
api
.
audio_tags
,
[]),
'embedding/tags'
:
(
api
.
embedding_tags
,
[]),
'embedding/tags'
:
(
api
.
embedding_tags
,
[]),
'histogram/tags'
:
(
api
.
histogram_tags
,
[]),
'histogram/tags'
:
(
api
.
histogram_tags
,
[]),
...
@@ -225,6 +241,8 @@ def create_api_call(logdir, model, cache_timeout):
...
@@ -225,6 +241,8 @@ def create_api_call(logdir, model, cache_timeout):
'scalar/data'
:
(
api
.
scalar_data
,
[
'run'
,
'tag'
,
'type'
]),
'scalar/data'
:
(
api
.
scalar_data
,
[
'run'
,
'tag'
,
'type'
]),
'image/list'
:
(
api
.
image_list
,
[
'run'
,
'tag'
]),
'image/list'
:
(
api
.
image_list
,
[
'run'
,
'tag'
]),
'image/image'
:
(
api
.
image_image
,
[
'run'
,
'tag'
,
'index'
]),
'image/image'
:
(
api
.
image_image
,
[
'run'
,
'tag'
,
'index'
]),
'text/list'
:
(
api
.
text_list
,
[
'run'
,
'tag'
]),
'text/text'
:
(
api
.
text_text
,
[
'run'
,
'tag'
,
'index'
]),
'audio/list'
:
(
api
.
audio_list
,
[
'run'
,
'tag'
]),
'audio/list'
:
(
api
.
audio_list
,
[
'run'
,
'tag'
]),
'audio/audio'
:
(
api
.
audio_audio
,
[
'run'
,
'tag'
,
'index'
]),
'audio/audio'
:
(
api
.
audio_audio
,
[
'run'
,
'tag'
,
'index'
]),
'embedding/embedding'
:
(
api
.
embedding_embedding
,
[
'run'
,
'tag'
,
'reduction'
,
'dimension'
]),
'embedding/embedding'
:
(
api
.
embedding_embedding
,
[
'run'
,
'tag'
,
'reduction'
,
'dimension'
]),
...
...
visualdl/server/data_manager.py
浏览文件 @
f883251f
...
@@ -25,7 +25,8 @@ DEFAULT_PLUGIN_MAXSIZE = {
...
@@ -25,7 +25,8 @@ DEFAULT_PLUGIN_MAXSIZE = {
"audio"
:
10
,
"audio"
:
10
,
"pr_curve"
:
300
,
"pr_curve"
:
300
,
"roc_curve"
:
300
,
"roc_curve"
:
300
,
"meta_data"
:
100
"meta_data"
:
100
,
"text"
:
10
}
}
...
@@ -350,7 +351,9 @@ class DataManager(object):
...
@@ -350,7 +351,9 @@ class DataManager(object):
"roc_curve"
:
"roc_curve"
:
Reservoir
(
max_size
=
DEFAULT_PLUGIN_MAXSIZE
[
"roc_curve"
]),
Reservoir
(
max_size
=
DEFAULT_PLUGIN_MAXSIZE
[
"roc_curve"
]),
"meta_data"
:
"meta_data"
:
Reservoir
(
max_size
=
DEFAULT_PLUGIN_MAXSIZE
[
"meta_data"
])
Reservoir
(
max_size
=
DEFAULT_PLUGIN_MAXSIZE
[
"meta_data"
]),
"text"
:
Reservoir
(
max_size
=
DEFAULT_PLUGIN_MAXSIZE
[
"text"
])
}
}
self
.
_mutex
=
threading
.
Lock
()
self
.
_mutex
=
threading
.
Lock
()
...
...
visualdl/server/lib.py
浏览文件 @
f883251f
...
@@ -158,6 +158,26 @@ def get_individual_image(log_reader, run, tag, step_index):
...
@@ -158,6 +158,26 @@ def get_individual_image(log_reader, run, tag, step_index):
return
records
[
step_index
].
image
.
encoded_image_string
return
records
[
step_index
].
image
.
encoded_image_string
def
get_text_tag_steps
(
log_reader
,
run
,
tag
):
run
=
log_reader
.
name2tags
[
run
]
if
run
in
log_reader
.
name2tags
else
run
log_reader
.
load_new_data
()
records
=
log_reader
.
data_manager
.
get_reservoir
(
"text"
).
get_items
(
run
,
decode_tag
(
tag
))
result
=
[{
"step"
:
item
.
id
,
"wallTime"
:
s2ms
(
item
.
timestamp
)
}
for
item
in
records
]
return
result
def
get_individual_text
(
log_reader
,
run
,
tag
,
step_index
):
run
=
log_reader
.
name2tags
[
run
]
if
run
in
log_reader
.
name2tags
else
run
log_reader
.
load_new_data
()
records
=
log_reader
.
data_manager
.
get_reservoir
(
"text"
).
get_items
(
run
,
decode_tag
(
tag
))
return
records
[
step_index
].
text
.
encoded_text_string
def
get_audio_tag_steps
(
log_reader
,
run
,
tag
):
def
get_audio_tag_steps
(
log_reader
,
run
,
tag
):
run
=
log_reader
.
name2tags
[
run
]
if
run
in
log_reader
.
name2tags
else
run
run
=
log_reader
.
name2tags
[
run
]
if
run
in
log_reader
.
name2tags
else
run
log_reader
.
load_new_data
()
log_reader
.
load_new_data
()
...
...
visualdl/writer/writer.py
浏览文件 @
f883251f
...
@@ -18,7 +18,8 @@ import time
...
@@ -18,7 +18,8 @@ import time
import
numpy
as
np
import
numpy
as
np
from
visualdl.writer.record_writer
import
RecordFileWriter
from
visualdl.writer.record_writer
import
RecordFileWriter
from
visualdl.utils.img_util
import
merge_images
from
visualdl.utils.img_util
import
merge_images
from
visualdl.component.base_component
import
scalar
,
image
,
embedding
,
audio
,
histogram
,
pr_curve
,
roc_curve
,
meta_data
from
visualdl.component.base_component
import
scalar
,
image
,
embedding
,
audio
,
\
histogram
,
pr_curve
,
roc_curve
,
meta_data
,
text
class
DummyFileWriter
(
object
):
class
DummyFileWriter
(
object
):
...
@@ -190,6 +191,26 @@ class LogWriter(object):
...
@@ -190,6 +191,26 @@ class LogWriter(object):
image
(
tag
=
tag
,
image_array
=
img
,
step
=
step
,
walltime
=
walltime
,
image
(
tag
=
tag
,
image_array
=
img
,
step
=
step
,
walltime
=
walltime
,
dataformats
=
dataformats
))
dataformats
=
dataformats
))
def
add_text
(
self
,
tag
,
text_string
,
step
=
None
,
walltime
=
None
):
"""Add an text to vdl record file.
Args:
tag (string): Data identifier
text_string (string): Value of text
step (int): Step of text
walltime (int): Wall time of text
Example:
for index in range(1, 101):
writer.add_text(tag="train/loss", text_string=str(index) + 'text', step=index)
"""
if
'%'
in
tag
:
raise
RuntimeError
(
"% can't appear in tag!"
)
walltime
=
round
(
time
.
time
()
*
1000
)
if
walltime
is
None
else
walltime
self
.
_get_file_writer
().
add_record
(
text
(
tag
=
tag
,
text_string
=
text_string
,
step
=
step
,
walltime
=
walltime
))
def
add_image_matrix
(
self
,
tag
,
imgs
,
step
,
rows
=-
1
,
scale
=
1.0
,
walltime
=
None
,
dataformats
=
"HWC"
):
def
add_image_matrix
(
self
,
tag
,
imgs
,
step
,
rows
=-
1
,
scale
=
1.0
,
walltime
=
None
,
dataformats
=
"HWC"
):
"""Add an image to vdl record file.
"""Add an image to vdl record file.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录