Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
fix 333 (#340)
Browse files Browse the repository at this point in the history
* added label correction to train gradient

* changing the gradient data generator to take inline/crossline argument conssistent with the patchloader

* changing variable name to be more descriptive


Co-authored-by: maxkazmsft <maxkaz@microsoft.com>
  • Loading branch information
fazamani and maxkazmsft authored Jun 4, 2020
1 parent 986e1ac commit 55bad56
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scripts/gen_checkerboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def make_box(n_inlines, n_crosslines, n_depth, box_size):

def make_gradient(n_inlines, n_crosslines, n_depth, box_size, dir="inline"):
"""
Makes a 3D box gradient pattern in a particula direction
Makes a 3D box gradient pattern in a particular direction
:param n_inlines: dim x
:param n_crosslines: dim y
Expand All @@ -83,7 +83,14 @@ def make_gradient(n_inlines, n_crosslines, n_depth, box_size, dir="inline"):
:return: numpy array
"""

axis = GRADIENT_DIR.index(dir)
orthogonal_dir = dir # for depth case
if dir=='inline':
orthogonal_dir = 'crossline'
elif dir=='crossline':
orthogonal_dir = 'inline'

axis = GRADIENT_DIR.index(orthogonal_dir)

n_points = (n_inlines, n_crosslines, n_depth)[axis]
n_classes = int(np.ceil(float(n_points) / box_size))
logging.info(f"GRADIENT: we will output {n_classes} classes in the {dir} direction")
Expand Down Expand Up @@ -184,6 +191,8 @@ def main(args):
)
checkerboard_train_seismic = checkerboard_train_seismic.astype(train_seismic.dtype)
checkerboard_train_labels = checkerboard_train_seismic.astype(train_labels.dtype)
# labels are integers and start from zero
checkerboard_train_labels[checkerboard_train_seismic < WHITE_LABEL] = WHITE_LABEL

# create checkerbox
logging.info("test1 gradient")
Expand Down

0 comments on commit 55bad56

Please sign in to comment.