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
d7dc6bd3
Commit
d7dc6bd3
authored
Sep 20, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more testing
parent
6e9382a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
7 deletions
+39
-7
infer_qcds_01.py
infer_qcds_01.py
+21
-4
infer_qcds_graph_01.py
infer_qcds_graph_01.py
+18
-3
No files found.
infer_qcds_01.py
View file @
d7dc6bd3
...
...
@@ -16,7 +16,6 @@ import qcstereo_functions as qsf
import
tensorflow
as
tf
from
tensorflow.python.ops
import
resource_variable_ops
tf
.
ResourceVariable
=
resource_variable_ops
.
ResourceVariable
qsf
.
TIME_START
=
time
.
time
()
...
...
@@ -146,6 +145,18 @@ rv_stage1_out = tf.Variable(
collections
=
[
GraphKeys
.
LOCAL_VARIABLES
],
# Works, available with tf.local_variables()
dtype
=
np
.
float32
,
name
=
'rv_stage1_out'
)
'''
rv_stage1_out = tf.get_variable("rv_stage1_out",
shape=[HEIGHT * WIDTH, NN_LAYOUT1[-1]],
dtype=tf.float32,
initializer=tf.zeros_initializer,
collections = [GraphKeys.LOCAL_VARIABLES], trainable=False)
'''
#rv_stageX_out_init_placeholder = tf.placeholder(tf.float32, shape=[HEIGHT * WIDTH, NN_LAYOUT1[-1]])
#rv_stageX_out_init_op = rv_stageX_out.assign(rv_stageX_out_init_placeholder)
##stage1_tiled = tf.reshape(rv_stage1_out.read_value(),[HEIGHT, WIDTH, -1], name = 'stage1_tiled')
stage1_tiled
=
tf
.
reshape
(
rv_stage1_out
,
[
HEIGHT
,
WIDTH
,
-
1
],
name
=
'stage1_tiled'
)
# no need to synchronize here?
...
...
@@ -220,7 +231,7 @@ tf.add_to_collection(collection_io, stage2_out_sparse)
"""
##saver=tf.train.Saver()
saver
=
tf
.
train
.
Saver
(
tf
.
global_variables
())
#saver
2 =
tf.train.Saver(tf.global_variables()+tf.local_variables())
#saver
=
tf.train.Saver(tf.global_variables()+tf.local_variables())
saver_def
=
saver
.
as_saver_def
()
...
...
@@ -250,9 +261,13 @@ except:
with
tf
.
Session
()
as
sess
:
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
local_variables_initializer
())
saver
.
restore
(
sess
,
files
[
"checkpoints"
])
saver
.
restore
(
sess
,
files
[
"checkpoints"
])
#tf.add_to_collection(GraphKeys.GLOBAL_VARIABLES,rv_stage1_out)
saver
.
save
(
sess
,
files
[
"inference"
])
#TODO: move to different subdir
#saver2.save(sess, files["inference"]+"_2") #TODO: move to different subdir
...
...
@@ -263,6 +278,8 @@ with tf.Session() as sess:
if
LOGPATH
:
lf
=
open
(
LOGPATH
,
"w"
)
#overwrite previous (or make it "a"?
#_ = sess.run([rv_stageX_out_init_op],feed_dict={rv_stageX_out_init_placeholder: np.zeros((HEIGHT * WIDTH, NN_LAYOUT1[-1]))})
for
nimg
,
_
in
enumerate
(
image_data
):
dataset_img
=
qsf
.
readImageData
(
image_data
=
image_data
,
...
...
@@ -296,7 +313,7 @@ with tf.Session() as sess:
try
:
os
.
makedirs
(
os
.
path
.
dirname
(
result_file
))
except
:
pass
pass
rslt
=
np
.
concatenate
(
[
disp_out
.
reshape
(
-
1
,
1
),
...
...
infer_qcds_graph_01.py
View file @
d7dc6bd3
...
...
@@ -129,6 +129,8 @@ try:
except
:
pass
from
tensorflow.python.framework.ops
import
GraphKeys
with
tf
.
Session
()
as
sess
:
# default option
...
...
@@ -162,10 +164,23 @@ with tf.Session() as sess:
if
not
USE_SPARSE_ONLY
:
#Does it reduce the graph size?
stage2_out_full
=
graph
.
get_tensor_by_name
(
'Disparity_net/stage2_out_full:0'
)
'''
if not use_saved_model:
rv_stage1_out = tf.get_variable("rv_stage1_out",
shape=[78408, 32],
dtype=tf.float32,
initializer=tf.zeros_initializer)
#collections = [GraphKeys.LOCAL_VARIABLES],trainable=False)
'''
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
local_variables_initializer
())
infer_saver
.
restore
(
sess
,
files
[
"inference"
])
# after initializers, of course
if
not
use_saved_model
:
infer_saver
.
restore
(
sess
,
files
[
"inference"
])
# after initializers, of course
else
:
infer_saver
.
restore
(
sess
,
dirs
[
'exportdir'
]
+
"/variables/variables.data-00000-of-00001"
)
#infer_saver.restore(sess, files["inference"]+"_2") # after initializers, of course
merged
=
tf
.
summary
.
merge_all
()
...
...
@@ -222,8 +237,8 @@ with tf.Session() as sess:
if
not
use_saved_model
:
#builder.add_meta_graph_and_variables(sess,PB_TAGS)
builder
.
add_meta_graph_and_variables
(
sess
,[
tf
.
saved_model
.
tag_constants
.
SERVING
])
#
builder.save(True)
builder
.
save
(
False
)
builder
.
save
(
True
)
#
builder.save(False)
if
lf
:
lf
.
close
()
...
...
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