Commit 69def1b5 authored by Andrey Filippov's avatar Andrey Filippov

next version

parent f964c4f2
This diff is collapsed.
...@@ -199,8 +199,6 @@ def getMoreFiles(fpaths,rslt): ...@@ -199,8 +199,6 @@ def getMoreFiles(fpaths,rslt):
print_time("Done") print_time("Done")
rslt.append(dataset) rslt.append(dataset)
#from http://warmspringwinds.github.io/tensorflow/tf-slim/2016/12/21/tfrecords-guide/ #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):
reader = tf.TFRecordReader() reader = tf.TFRecordReader()
...@@ -247,7 +245,7 @@ def add_neibs(npa_ext,radius): ...@@ -247,7 +245,7 @@ def add_neibs(npa_ext,radius):
for dx in range (side): for dx in range (side):
npa_neib[:,:,dy, dx,:]= npa_ext[dy:dy+height, dx:dx+width] npa_neib[:,:,dy, dx,:]= npa_ext[dy:dy+height, dx:dx+width]
return npa_neib.reshape(height, width, -1) return npa_neib.reshape(height, width, -1)
def extend_img_to_clusters(datasets_img,radius): def extend_img_to_clusters(datasets_img,radius):
side = 2 * radius + 1 side = 2 * radius + 1
size = side * side size = side * side
...@@ -262,8 +260,6 @@ def extend_img_to_clusters(datasets_img,radius): ...@@ -262,8 +260,6 @@ def extend_img_to_clusters(datasets_img,radius):
rec['gt_ds'] = add_neibs(add_margins(rec['gt_ds'].reshape((height,width,-1)), radius, np.nan), radius).reshape((num_tiles,-1)) rec['gt_ds'] = add_neibs(add_margins(rec['gt_ds'].reshape((height,width,-1)), radius, np.nan), radius).reshape((num_tiles,-1))
pass pass
def reformat_to_clusters(datasets_data): def reformat_to_clusters(datasets_data):
cluster_size = (2 * CLUSTER_RADIUS + 1) * (2 * CLUSTER_RADIUS + 1) cluster_size = (2 * CLUSTER_RADIUS + 1) * (2 * CLUSTER_RADIUS + 1)
# Reformat input data # Reformat input data
...@@ -301,7 +297,6 @@ TILE_SIZE = TILE_SIDE* TILE_SIDE # == 81 ...@@ -301,7 +297,6 @@ TILE_SIZE = TILE_SIDE* TILE_SIDE # == 81
rec['corr2d'] = corr2d.reshape((corr2d.shape[0],-1)) rec['corr2d'] = corr2d.reshape((corr2d.shape[0],-1))
rec['target_disparity'] = target_disparity.reshape((target_disparity.shape[0],-1)) rec['target_disparity'] = target_disparity.reshape((target_disparity.shape[0],-1))
rec['gt_ds'] = gt_ds.reshape((gt_ds.shape[0],-1)) rec['gt_ds'] = gt_ds.reshape((gt_ds.shape[0],-1))
def replace_nan(datasets_data): def replace_nan(datasets_data):
cluster_size = (2 * CLUSTER_RADIUS + 1) * (2 * CLUSTER_RADIUS + 1) cluster_size = (2 * CLUSTER_RADIUS + 1) * (2 * CLUSTER_RADIUS + 1)
...@@ -353,7 +348,6 @@ def shuffle_chunks_in_place(datasets_data, tiles_groups_per_chunk): ...@@ -353,7 +348,6 @@ def shuffle_chunks_in_place(datasets_data, tiles_groups_per_chunk):
ds['target_disparity'] = ds['target_disparity'].reshape((chunks_per_file,-1))[permut].reshape((groups_per_file,-1)) ds['target_disparity'] = ds['target_disparity'].reshape((chunks_per_file,-1))[permut].reshape((groups_per_file,-1))
ds['gt_ds'] = ds['gt_ds']. reshape((chunks_per_file,-1))[permut].reshape((groups_per_file,-1)) ds['gt_ds'] = ds['gt_ds']. reshape((chunks_per_file,-1))[permut].reshape((groups_per_file,-1))
def _setFileSlot(train_next,files): def _setFileSlot(train_next,files):
train_next['files'] = files train_next['files'] = files
train_next['slots'] = min(train_next['files'], MAX_FILES_PER_GROUP) train_next['slots'] = min(train_next['files'], MAX_FILES_PER_GROUP)
...@@ -375,8 +369,6 @@ def replaceDataset(datasets_data, new_dataset, nset, period, findx): ...@@ -375,8 +369,6 @@ def replaceDataset(datasets_data, new_dataset, nset, period, findx):
datasets_data[findx]['corr2d'] [nset::period] = new_dataset['corr2d'] datasets_data[findx]['corr2d'] [nset::period] = new_dataset['corr2d']
datasets_data[findx]['target_disparity'][nset::period] = new_dataset['target_disparity'] datasets_data[findx]['target_disparity'][nset::period] = new_dataset['target_disparity']
datasets_data[findx]['gt_ds'] [nset::period] = new_dataset['gt_ds'] datasets_data[findx]['gt_ds'] [nset::period] = new_dataset['gt_ds']
def zip_lvar_hvar(datasets_all_data, del_src = True): def zip_lvar_hvar(datasets_all_data, del_src = True):
...@@ -416,7 +408,6 @@ def reduce_tile_size(datasets_data, num_tile_layers, reduced_tile_side): ...@@ -416,7 +408,6 @@ def reduce_tile_size(datasets_data, num_tile_layers, reduced_tile_side):
[..., offs:offs+reduced_tile_side, offs:offs+reduced_tile_side]. [..., offs:offs+reduced_tile_side, offs:offs+reduced_tile_side].
reshape(-1,num_tile_layers*reduced_tile_side*reduced_tile_side)) reshape(-1,num_tile_layers*reduced_tile_side*reduced_tile_side))
def result_npy_to_tiff(npy_path, absolute, fix_nan): def result_npy_to_tiff(npy_path, absolute, fix_nan):
""" """
......
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