Commit ddd193c9 authored by Andrey Filippov's avatar Andrey Filippov

more lwir-related updates

parent e3d871ba
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1693,7 +1693,7 @@ if __name__ == "__main__": ...@@ -1693,7 +1693,7 @@ if __name__ == "__main__":
VARIANCE_SCALE_DISPARITY = 5.0 #Scale variance if average is above this VARIANCE_SCALE_DISPARITY = 5.0 #Scale variance if average is above this
NUM_TRAIN_SETS = 32 # 8 NUM_TRAIN_SETS = 32 # 8
FGBGMODE_TEST = 3 # 0 - average, 1 - FG, 2 - BG, 3 - AUX FGBGMODE_TESTS = [1,3] # 0 - average, 1 - FG, 2 - BG, 3 - AUX
FGBGMODE_TRAIN = 1 # 0 - average, 1 - FG, 2 - BG FGBGMODE_TRAIN = 1 # 0 - average, 1 - FG, 2 - BG
RND_AMPLIUDE_TEST = 0.5 # present corr2d rendered +/- this far from the GT RND_AMPLIUDE_TEST = 0.5 # present corr2d rendered +/- this far from the GT
RND_AMPLIUDE_TRAIN_TILE = 0.5 # train with corr2d rendered +/- this far from the GT - independent for each tile component RND_AMPLIUDE_TRAIN_TILE = 0.5 # train with corr2d rendered +/- this far from the GT - independent for each tile component
...@@ -1725,14 +1725,14 @@ if __name__ == "__main__": ...@@ -1725,14 +1725,14 @@ if __name__ == "__main__":
''' Prepare full image for testing ''' ''' Prepare full image for testing '''
for model_ml_path in test_sets: for model_ml_path in test_sets:
for fgbgmode_test in FGBGMODE_TESTS:
writeTFRecordsFromImageSet( writeTFRecordsFromImageSet(
model_ml_path, # model/version/ml_dir model_ml_path, # model/version/ml_dir
FGBGMODE_TEST, # 0, # expot_mode, # 0 - GT average, 1 - GT FG, 2 - GT BG, 3 - AUX disparity fgbgmode_test, # 0, # expot_mode, # 0 - GT average, 1 - GT FG, 2 - GT BG, 3 - AUX disparity
RND_AMPLIUDE_TEST, # random_offset, # for modes 0..2 - add random offset of -random_offset to +random_offset, in mode 3 add random to GT average if no AUX data RND_AMPLIUDE_TEST, # random_offset, # for modes 0..2 - add random offset of -random_offset to +random_offset, in mode 3 add random to GT average if no AUX data
pathTFR) # TFR directory pathTFR) # TFR directory
# disp_bins = 20, # disp_bins = 20,
# str_bins=10) # str_bins=10)
......
...@@ -49,6 +49,7 @@ TILE_SIDE, TILE_LAYERS, TWO_TRAINS, NET_ARCH1, NET_ARCH2 = [None]*5 ...@@ -49,6 +49,7 @@ TILE_SIDE, TILE_LAYERS, TWO_TRAINS, NET_ARCH1, NET_ARCH2 = [None]*5
ABSOLUTE_DISPARITY,SYM8_SUB, WLOSS_LAMBDA, SLOSS_LAMBDA, SLOSS_CLIP = [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 SPREAD_CONVERGENCE, INTER_CONVERGENCE, HOR_FLIP, DISP_DIFF_CAP, DISP_DIFF_SLOPE = [None]*5
CLUSTER_RADIUS = None CLUSTER_RADIUS = None
FGBG_MODE = 1 # 0 - do not filter by single-plane, 1 - remove split plabnes tiles, 2 - remove split planes and neighbors
PARTIALS_WEIGHTS, MAX_IMGS_IN_MEM, MAX_FILES_PER_GROUP, BATCH_WEIGHTS, ONLY_TILE = [None] * 5 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 USE_CONFIDENCE, WBORDERS_ZERO, EPOCHS_TO_RUN, FILE_UPDATE_EPOCHS = [None] * 4
LR600,LR400,LR200,LR100,LR = [None]*5 LR600,LR400,LR200,LR100,LR = [None]*5
......
...@@ -47,8 +47,10 @@ Defined in config file ...@@ -47,8 +47,10 @@ Defined in config file
""" """
TILE_SIDE, TILE_LAYERS, TWO_TRAINS, NET_ARCH1, NET_ARCH2 = [None]*5 TILE_SIDE, TILE_LAYERS, TWO_TRAINS, NET_ARCH1, NET_ARCH2 = [None]*5
ABSOLUTE_DISPARITY,SYM8_SUB, WLOSS_LAMBDA, SLOSS_LAMBDA, SLOSS_CLIP = [None]*5 ABSOLUTE_DISPARITY,SYM8_SUB, WLOSS_LAMBDA, SLOSS_LAMBDA, SLOSS_CLIP = [None]*5
CORR2D_LIMITS = [None, None]
SPREAD_CONVERGENCE, INTER_CONVERGENCE, HOR_FLIP, DISP_DIFF_CAP, DISP_DIFF_SLOPE = [None]*5 SPREAD_CONVERGENCE, INTER_CONVERGENCE, HOR_FLIP, DISP_DIFF_CAP, DISP_DIFF_SLOPE = [None]*5
CLUSTER_RADIUS = None CLUSTER_RADIUS = None
FGBG_MODE = 1 # 0 - do not filter by single-plane, 1 - remove split plabnes tiles, 2 - remove split planes and neighbors
PARTIALS_WEIGHTS, MAX_IMGS_IN_MEM, MAX_FILES_PER_GROUP, BATCH_WEIGHTS, ONLY_TILE = [None] * 5 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 USE_CONFIDENCE, WBORDERS_ZERO, EPOCHS_TO_RUN, FILE_UPDATE_EPOCHS = [None] * 4
LR600,LR400,LR200,LR100,LR = [None]*5 LR600,LR400,LR200,LR100,LR = [None]*5
...@@ -64,7 +66,7 @@ globals().update(parameters) ...@@ -64,7 +66,7 @@ globals().update(parameters)
TRAIN_BUFFER_SIZE = TRAIN_BUFFER_GPU * TRAIN_BUFFER_CPU # in merged (quad) batches TRAIN_BUFFER_SIZE = TRAIN_BUFFER_GPU * TRAIN_BUFFER_CPU # in merged (quad) batches
qsf.setCorr2Limits(CORR2D_LIMITS) # limit min/max 2d correlation tiles values
#exit(0) #exit(0)
...@@ -91,9 +93,10 @@ NN_LAYOUT2 = qcstereo_network.NN_LAYOUTS[NET_ARCH2] ...@@ -91,9 +93,10 @@ NN_LAYOUT2 = qcstereo_network.NN_LAYOUTS[NET_ARCH2]
USE_PARTIALS = not PARTIALS_WEIGHTS is None # False - just a single Siamese net, True - partial outputs that use concentric squares of the first level subnets USE_PARTIALS = not PARTIALS_WEIGHTS is None # False - just a single Siamese net, True - partial outputs that use concentric squares of the first level subnets
# Tiff export slice labels # Tiff export slice labels
SLICE_LABELS = ["nn_out_ext","hier_out_ext","gt_disparity","gt_strength", SLICE_LABELS = ["nn_out_ext","target_disp","gt_disparity","gt_strength",
"cutcorn_cost_nw","cutcorn_cost", "cutcorn_cost_nw","cutcorn_cost",
"gt-avg_dist","avg8_disp","gt_disp","out-avg"] "gt_avg_dist","avg8_disp","gt_disp","out_avg",
"aux_disp","fg_disp","bg_disp","gt_rms","gt_rms_split"]
############################################################################## ##############################################################################
cluster_size = (2 * CLUSTER_RADIUS + 1) * (2 * CLUSTER_RADIUS + 1) cluster_size = (2 * CLUSTER_RADIUS + 1) * (2 * CLUSTER_RADIUS + 1)
...@@ -126,6 +129,7 @@ if not USE_PARTIALS: ...@@ -126,6 +129,7 @@ if not USE_PARTIALS:
qsf.evaluateAllResults(result_files = files['result'], qsf.evaluateAllResults(result_files = files['result'],
absolute_disparity = ABSOLUTE_DISPARITY, absolute_disparity = ABSOLUTE_DISPARITY,
cluster_radius = CLUSTER_RADIUS, cluster_radius = CLUSTER_RADIUS,
fgbg_mode= FGBG_MODE,
labels = SLICE_LABELS, labels = SLICE_LABELS,
logpath= LOGPATH) logpath= LOGPATH)
...@@ -390,7 +394,7 @@ with tf.Session() as sess: ...@@ -390,7 +394,7 @@ 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() merged = tf.compat.v1.summary.merge_all()
tt_writers = [] tt_writers = []
for p in TT_PATHS: for p in TT_PATHS:
tt_writers.append(tf.summary.FileWriter(p, sess.graph)) tt_writers.append(tf.summary.FileWriter(p, sess.graph))
...@@ -614,9 +618,9 @@ with tf.Session() as sess: ...@@ -614,9 +618,9 @@ with tf.Session() as sess:
files = files, files = files,
indx = ntest, indx = ntest,
cluster_radius = CLUSTER_RADIUS, cluster_radius = CLUSTER_RADIUS,
tile_layers = TILE_LAYERS, tile_layers = TILE_LAYERS, # 4
tile_side = TILE_SIDE, tile_side = TILE_SIDE, # 9
width = IMG_WIDTH, width = IMG_WIDTH, #160
replace_nans = True) replace_nans = True)
sess.run(iterator_tt.initializer, feed_dict={corr2d_train_placeholder: dataset_img['corr2d'], sess.run(iterator_tt.initializer, feed_dict={corr2d_train_placeholder: dataset_img['corr2d'],
...@@ -659,24 +663,41 @@ with tf.Session() as sess: ...@@ -659,24 +663,41 @@ with tf.Session() as sess:
os.makedirs(os.path.dirname(result_file)) os.makedirs(os.path.dirname(result_file))
except: except:
pass pass
extra = dataset_img['t_extra']
if extra is None:
extra = np.array([dataset_img['gtruths'].shape[0],0])
rslt = np.concatenate( rslt = np.concatenate(
[disp_out.reshape(-1,1), [disp_out.reshape(-1,1),
dataset_img['t_disps'], #t_disps[ntest], dataset_img['t_disps'], #t_disps[ntest], disp_out.shape[0],BATCH_SIZE
dataset_img['gtruths'], # gtruths[ntest], dataset_img['gtruths'], # gtruths[ntest],
dbg_cost_nw.reshape(-1,1), dbg_cost_nw.reshape(-1,1),
dbg_cost_w.reshape(-1,1), dbg_cost_w.reshape(-1,1),
dbg_d.reshape(-1,1), dbg_d.reshape(-1,1),
dbg_avg_disparity.reshape(-1,1), dbg_avg_disparity.reshape(-1,1),
dbg_gt_disparity.reshape(-1,1), dbg_gt_disparity.reshape(-1,1),
dbg_offs.reshape(-1,1)],1) dbg_offs.reshape(-1,1),
extra, # len 3..6,
np.save(result_file, rslt.reshape(HEIGHT,WIDTH,-1)) #adding extra data layers
rslt = qsf.eval_results(result_file, ABSOLUTE_DISPARITY, radius=CLUSTER_RADIUS, logfile=lf) ],1)
img_gain_test0 = rslt[0][0]/rslt[0][1] num_slices = rslt.shape[1]
img_gain_test9 = rslt[9][0]/rslt[9][1] np.save(
result_file,
rslt.reshape(HEIGHT,WIDTH,-1))
eval_rslt = qsf.eval_results(
result_file,
ABSOLUTE_DISPARITY,
radius=0, # CLUSTER_RADIUS,
last_fgbg_mode = 1,
logfile=lf)
img_gain_test0 = eval_rslt[0][0]/eval_rslt[0][1]
img_gain_test9 = eval_rslt[9][0]/eval_rslt[9][1]
if SAVE_TIFFS: if SAVE_TIFFS:
qsf.result_npy_to_tiff(result_file, ABSOLUTE_DISPARITY, fix_nan = True,labels=SLICE_LABELS, logfile=lf) qsf.result_npy_to_tiff(
result_file,
ABSOLUTE_DISPARITY,
fix_nan = True,
labels=SLICE_LABELS[0:num_slices],
logfile=lf)
""" """
Remove dataset_img (if it is not [0] to reduce memory footprint Remove dataset_img (if it is not [0] to reduce memory footprint
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment