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
17304955
Commit
17304955
authored
Sep 02, 2018
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
making pydev happy
parent
92d4bc4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
17 deletions
+41
-17
nn_ds_neibs16.py
nn_ds_neibs16.py
+19
-3
qcstereo_functions.py
qcstereo_functions.py
+22
-14
No files found.
nn_ds_neibs16.py
View file @
17304955
...
...
@@ -55,7 +55,22 @@ Temporarily for backward compatibility
"""
if
not
"SLOSS_CLIP"
in
parameters
:
parameters
[
'SLOSS_CLIP'
]
=
0.5
print
(
"Old config, setting SLOSS_CLIP="
,
SLOSS_CLIP
)
print
(
"Old config, setting SLOSS_CLIP="
,
parameters
[
'SLOSS_CLIP'
])
"""
Defined in config file
"""
TILE_SIDE
,
TILE_LAYERS
,
TWO_TRAINS
,
NET_ARCH1
,
NET_ARCH2
=
[
None
]
*
5
ABSOLUTE_DISPARITY
,
SYM8_SUB
,
WLOSS_LAMBDA
,
SLOSS_LAMBDA
,
SLOSS_CLIP
=
[
None
]
*
5
SPREAD_CONVERGENCE
,
INTER_CONVERGENCE
,
HOR_FLIP
,
DISP_DIFF_CAP
,
DISP_DIFF_SLOPE
=
[
None
]
*
5
CLUSTER_RADIUS
=
None
PARTIALS_WEIGHTS
,
MAX_IMGS_IN_MEM
,
MAX_FILES_PER_GROUP
,
BATCH_WEIGHTS
,
ONLY_TILE
=
[
None
]
*
5
USE_CONFIDENCE
,
WBORDERS_ZERO
,
EPOCHS_TO_RUN
,
FILE_UPDATE_EPOCHS
=
[
None
]
*
4
LR600
,
LR400
,
LR200
,
LR100
,
LR
=
[
None
]
*
5
SHUFFLE_FILES
,
EPOCHS_FULL_TEST
,
SAVE_TIFFS
=
[
None
]
*
3
globals
()
.
update
(
parameters
)
...
...
@@ -178,7 +193,7 @@ def debug_gt_variance(
gt_ds_batch
# [?:9:2]
):
with
tf
.
name_scope
(
"Debug_GT_Variance"
):
tf_num_tiles
=
tf
.
shape
(
gt_ds_batch
)[
0
]
#
tf_num_tiles = tf.shape(gt_ds_batch)[0]
d_gt_this
=
tf
.
reshape
(
gt_ds_batch
[:,
2
*
indx
],[
-
1
],
name
=
"d_this"
)
d_gt_center
=
tf
.
reshape
(
gt_ds_batch
[:,
2
*
center_indx
],[
-
1
],
name
=
"d_center"
)
d_gt_diff
=
tf
.
subtract
(
d_gt_this
,
d_gt_center
,
name
=
"d_diff"
)
...
...
@@ -401,7 +416,8 @@ with tf.Session() as sess:
img_gain_test9
=
1.0
num_train_variants
=
len
(
datasets_train
)
thr
=
None
;
thr
=
None
thr_result
=
None
trains_to_update
=
[
train_next
[
n_train
][
'files'
]
>
train_next
[
n_train
][
'slots'
]
for
n_train
in
range
(
len
(
train_next
))]
for
epoch
in
range
(
EPOCHS_TO_RUN
):
"""
...
...
qcstereo_functions.py
View file @
17304955
...
...
@@ -10,7 +10,8 @@ import tensorflow as tf
import
xml.etree.ElementTree
as
ET
import
time
import
imagej_tiffwriter
TIME_LAST
=
0
TIME_START
=
0
class
bcolors
:
HEADER
=
'
\033
[95m'
...
...
@@ -32,8 +33,6 @@ def print_time(txt="",end="\n"):
def
parseXmlConfig
(
conf_file
,
root_dir
):
tree
=
ET
.
parse
(
conf_file
)
root
=
tree
.
getroot
()
directories
=
root
.
find
(
'directories'
)
files
=
root
.
find
(
'files'
)
parameters
=
{}
for
p
in
root
.
find
(
'parameters'
):
parameters
[
p
.
tag
]
=
eval
(
p
.
text
.
strip
())
...
...
@@ -141,7 +140,7 @@ def getMoreFiles(fpaths,rslt, cluster_radius, hor_flip, tile_layers, tile_side):
rslt
.
append
(
dataset
)
#from http://warmspringwinds.github.io/tensorflow/tf-slim/2016/12/21/tfrecords-guide/
def
read_and_decode
(
filename_queue
):
def
read_and_decode
(
filename_queue
,
featrures_per_tile
):
reader
=
tf
.
TFRecordReader
()
_
,
serialized_example
=
reader
.
read
(
filename_queue
)
...
...
@@ -149,7 +148,7 @@ def read_and_decode(filename_queue):
serialized_example
,
# Defaults are not specified since both keys are required.
features
=
{
'corr2d'
:
tf
.
FixedLenFeature
([
FEATURES_PER_TILE
],
tf
.
float32
),
#string),
'corr2d'
:
tf
.
FixedLenFeature
([
featrures_per_tile
],
tf
.
float32
),
#string),
'target_disparity'
:
tf
.
FixedLenFeature
([
1
],
tf
.
float32
),
#.string),
'gt_ds'
:
tf
.
FixedLenFeature
([
2
],
tf
.
float32
)
#.string)
})
...
...
@@ -488,19 +487,28 @@ def result_npy_to_tiff(npy_path, absolute, fix_nan, insert_deltas=True):
"""
tiff_path
=
npy_path
.
replace
(
'.npy'
,
'.tiff'
)
data
=
np
.
load
(
npy_path
)
#(324,242,4) [nn_disp, target_disp,gt_disp, gt_conf]
nn_out
=
0
target_disparity
=
1
gt_disparity
=
2
gt_strength
=
3
if
not
absolute
:
if
fix_nan
:
data
[
...
,
0
]
+=
np
.
nan_to_num
(
data
[
...
,
1
],
copy
=
True
)
data
[
...
,
nn_out
]
+=
np
.
nan_to_num
(
data
[
...
,
1
],
copy
=
True
)
else
:
data
[
...
,
0
]
+=
data
[
...
,
1
]
data
[
...
,
nn_out
]
+=
data
[
...
,
1
]
if
insert_deltas
:
data
=
np
.
concatenate
([
data
[
...
,
0
:
4
],
data
[
...
,
0
:
2
],
data
[
...
,
4
:]],
axis
=
2
)
data
[
...
,
4
]
-=
data
[
...
,
2
]
data
[
...
,
5
]
-=
data
[
...
,
2
]
np
.
nan_to_num
(
data
[
...
,
3
],
copy
=
False
)
data
[
...
,
4
]
=
np
.
select
([
data
[
...
,
3
]
==
0.0
,
data
[
...
,
3
]
>
0.0
],
[
np
.
nan
,
data
[
...
,
4
]])
data
[
...
,
5
]
=
np
.
select
([
data
[
...
,
3
]
==
0.0
,
data
[
...
,
3
]
>
0.0
],
[
np
.
nan
,
data
[
...
,
5
]])
np
.
nan_to_num
(
data
[
...
,
gt_strength
],
copy
=
False
)
data
=
np
.
concatenate
([
data
[
...
,
0
:
4
],
data
[
...
,
0
:
2
],
data
[
...
,
0
:
2
],
data
[
...
,
4
:]],
axis
=
2
)
data
[
...
,
6
]
-=
data
[
...
,
gt_disparity
]
data
[
...
,
7
]
-=
data
[
...
,
gt_disparity
]
for
l
in
[
4
,
5
,
6
,
7
]:
data
[
...
,
l
]
=
np
.
select
([
data
[
...
,
gt_strength
]
==
0.0
,
data
[
...
,
gt_strength
]
>
0.0
],
[
np
.
nan
,
data
[
...
,
l
]])
# All other layers - mast too
for
l
in
range
(
8
,
data
.
shape
[
2
]):
data
[
...
,
l
]
=
np
.
select
([
data
[
...
,
gt_strength
]
==
0.0
,
data
[
...
,
gt_strength
]
>
0.0
],
[
np
.
nan
,
data
[
...
,
l
]])
# data[...,4] = np.select([data[...,3]==0.0, data[...,3]>0.0], [np.nan,data[...,4]])
# data[...,5] = np.select([data[...,3]==0.0, data[...,3]>0.0], [np.nan,data[...,5]])
data
=
data
.
transpose
(
2
,
0
,
1
)
print
(
"Saving results to TIFF: "
+
tiff_path
)
...
...
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