Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
python3-imagej-tiff
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
python3-imagej-tiff
Commits
7a9d4e6e
Commit
7a9d4e6e
authored
Aug 29, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
colored weights
parent
90a92606
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
24 deletions
+37
-24
nn_ds_neibs11_tmp.py
nn_ds_neibs11_tmp.py
+37
-24
No files found.
nn_ds_neibs11_tmp.py
View file @
7a9d4e6e
...
@@ -1326,20 +1326,28 @@ with tf.Session() as sess:
...
@@ -1326,20 +1326,28 @@ with tf.Session() as sess:
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
local_variables_initializer
())
sess
.
run
(
tf
.
local_variables_initializer
())
merged
=
tf
.
summary
.
merge_all
()
# display weights, part 1 begin
# display weights, part 1 begin
import
numpy_visualize_weights
as
npw
import
numpy_visualize_weights
as
npw
#l1 = NN_LAYOUT1.index(next(filter(lambda x: x!=0, NN_LAYOUT1)))
# only for SYM8_SUB
#l2 = NN_LAYOUT2.index(next(filter(lambda x: x!=0, NN_LAYOUT2)))
if
SYM8_SUB
:
#wimg1_placeholder = tf.placeholder(tf.float32, [1,160,80,3])
l1
=
NN_LAYOUT1
.
index
(
next
(
filter
(
lambda
x
:
x
!=
0
,
NN_LAYOUT1
)))
#wimg1 = tf.summary.image('weights/sub_'+str(l1), wimg1_placeholder)
l1_sym8
=
NN_LAYOUT1
[
l1
]
//
8
l1_non_sum
=
NN_LAYOUT1
[
l1
]
%
8
#wimg2_placeholder = tf.placeholder(tf.float32, [1,120,60,3])
if
l1_non_sum
==
0
:
#wimg2 = tf.summary.image('weights/inter_'+str(l2), wimg2_placeholder)
wimg1_placeholder
=
tf
.
placeholder
(
tf
.
float32
,
[
1
,
40
,
80
,
3
])
wimg1
=
tf
.
summary
.
image
(
'weights/sub_'
+
str
(
l1
),
wimg1_placeholder
)
l2
=
NN_LAYOUT2
.
index
(
next
(
filter
(
lambda
x
:
x
!=
0
,
NN_LAYOUT2
)))
wimg2_placeholder
=
tf
.
placeholder
(
tf
.
float32
,
[
1
,
250
,
100
,
3
])
wimg2
=
tf
.
summary
.
image
(
'weights/inter_'
+
str
(
l2
),
wimg2_placeholder
)
# display weights, part 1 end
# display weights, part 1 end
merged
=
tf
.
summary
.
merge_all
()
train_writer
=
tf
.
summary
.
FileWriter
(
TRAIN_PATH
,
sess
.
graph
)
train_writer
=
tf
.
summary
.
FileWriter
(
TRAIN_PATH
,
sess
.
graph
)
test_writer
=
tf
.
summary
.
FileWriter
(
TEST_PATH
,
sess
.
graph
)
test_writer
=
tf
.
summary
.
FileWriter
(
TEST_PATH
,
sess
.
graph
)
test_writer1
=
tf
.
summary
.
FileWriter
(
TEST_PATH1
,
sess
.
graph
)
test_writer1
=
tf
.
summary
.
FileWriter
(
TEST_PATH1
,
sess
.
graph
)
...
@@ -1552,24 +1560,29 @@ with tf.Session() as sess:
...
@@ -1552,24 +1560,29 @@ with tf.Session() as sess:
# display weights, part 2 begin
# display weights, part 2 begin
#l1 = NN_LAYOUT1.index(next(filter(lambda x: x!=0, NN_LAYOUT1)))
#l2 = NN_LAYOUT2.index(next(filter(lambda x: x!=0, NN_LAYOUT2)))
#with tf.variable_scope('g_fc_sub'+str(l1),reuse=tf.AUTO_REUSE):
if
SYM8_SUB
:
#w = tf.get_variable('weights',shape=[325,NN_LAYOUT1[l1]])
#w = tf.transpose(w,(1,0))
#l1 = NN_LAYOUT1.index(next(filter(lambda x: x!=0, NN_LAYOUT1)))
#img1 = npw.tiles(npw.coldmap(w.eval(),zero_span=0.0002),(1,4,9,9),tiles_per_line=2,borders=True)
#l1_sym8 = NN_LAYOUT1[l1] // 8
#img1 = img1[np.newaxis,...]
#l1_non_sum = NN_LAYOUT1[l1] % 8
#train_writer.add_summary(wimg1.eval(feed_dict={wimg1_placeholder: img1}), epoch)
#with tf.variable_scope('g_fc_inter'+str(l2),reuse=tf.AUTO_REUSE):
#w = tf.get_variable('weights',shape=[144,NN_LAYOUT1[l2]])
#w = tf.transpose(w,(1,0))
#img2 = npw.tiles(npw.coldmap(w.eval(),zero_span=0.0002),(3,3,4,4),tiles_per_line=4,borders=True)
#img2 = img2[np.newaxis,...]
#train_writer.add_summary(wimg2.eval(feed_dict={wimg2_placeholder: img2}), epoch)
if
l1_non_sum
==
0
:
with
tf
.
variable_scope
(
'g_fc_sub'
+
str
(
l1
),
reuse
=
tf
.
AUTO_REUSE
):
w
=
tf
.
get_variable
(
'weights'
,
shape
=
[
325
,
l1_sym8
])
w
=
tf
.
transpose
(
w
,(
1
,
0
))
img1
=
npw
.
tiles
(
npw
.
coldmap
(
w
.
eval
(),
zero_span
=
0.0002
),(
1
,
4
,
9
,
9
),
tiles_per_line
=
2
,
borders
=
True
)
img1
=
img1
[
np
.
newaxis
,
...
]
train_writer
.
add_summary
(
wimg1
.
eval
(
feed_dict
=
{
wimg1_placeholder
:
img1
}),
epoch
)
#l2 = NN_LAYOUT2.index(next(filter(lambda x: x!=0, NN_LAYOUT2)))
with
tf
.
variable_scope
(
'g_fc_inter'
+
str
(
l2
),
reuse
=
tf
.
AUTO_REUSE
):
w
=
tf
.
get_variable
(
'weights'
,
shape
=
[
400
,
NN_LAYOUT2
[
l2
]])
w
=
tf
.
transpose
(
w
,(
1
,
0
))
img2
=
npw
.
tiles
(
npw
.
coldmap
(
w
.
eval
(),
zero_span
=
0.0002
),(
5
,
5
,
4
,
4
),
tiles_per_line
=
4
,
borders
=
True
)
img2
=
img2
[
np
.
newaxis
,
...
]
train_writer
.
add_summary
(
wimg2
.
eval
(
feed_dict
=
{
wimg2_placeholder
:
img2
}),
epoch
)
# display weights, part 2 end
# display weights, part 2 end
train_writer
.
add_summary
(
train_summary
,
epoch
)
train_writer
.
add_summary
(
train_summary
,
epoch
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment