FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Caffe_1.0_Windows/python/draw_net.py at master · Coderx7/Caffe_1.0_Windows · GitHub
Coderx7
/
Caffe_1.0_Windows
Public
Notifications
You must be signed in to change notification settings
Fork
8
Star
28
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Caffe_1.0_Windows
/
python
/
draw_net.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (48 loc) · 1.89 KB
Breadcrumbs
Caffe_1.0_Windows
/
python
/
draw_net.py
Copy path
File metadata and controls
58 lines (48 loc) · 1.89 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
"""
Draw a graph of the net architecture.
"""
from
argparse
import
ArgumentParser
,
ArgumentDefaultsHelpFormatter
from
google
.
protobuf
import
text_format
import
caffe
import
caffe
.
draw
from
caffe
.
proto
import
caffe_pb2
def
parse_args
():
"""Parse input arguments
"""
parser
=
ArgumentParser
(
description
=
__doc__
,
formatter_class
=
ArgumentDefaultsHelpFormatter
)
parser
.
add_argument
(
'input_net_proto_file'
,
help
=
'Input network prototxt file'
)
parser
.
add_argument
(
'output_image_file'
,
help
=
'Output image file'
)
parser
.
add_argument
(
'--rankdir'
,
help
=
(
'One of TB (top-bottom, i.e., vertical), '
'RL (right-left, i.e., horizontal), or another '
'valid dot option; see '
'http://www.graphviz.org/doc/info/'
'attrs.html#k:rankdir'
),
default
=
'LR'
)
parser
.
add_argument
(
'--phase'
,
help
=
(
'Which network phase to draw: can be TRAIN, '
'TEST, or ALL. If ALL, then all layers are drawn '
'regardless of phase.'
),
default
=
"ALL"
)
args
=
parser
.
parse_args
()
return
args
def
main
():
args
=
parse_args
()
net
=
caffe_pb2
.
NetParameter
()
text_format
.
Merge
(
open
(
args
.
input_net_proto_file
).
read
(),
net
)
print
(
'Drawing net to %s'
%
args
.
output_image_file
)
phase
=
None
;
if
args
.
phase
==
"TRAIN"
:
phase
=
caffe
.
TRAIN
elif
args
.
phase
==
"TEST"
:
phase
=
caffe
.
TEST
elif
args
.
phase
!=
"ALL"
:
raise
ValueError
(
"Unknown phase: "
+
args
.
phase
)
caffe
.
draw
.
draw_net_to_file
(
net
,
args
.
output_image_file
,
args
.
rankdir
,
phase
)
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL