예제 #1
0
tf.config.set_soft_device_placement(True)
# tf.config.experimental.set_visible_devices(NUM_PARALLEL_EXEC_UNITS, 'CPU')
os.environ["OMP_NUM_THREADS"] = str(NUM_PARALLEL_EXEC_UNITS)
os.environ["KMP_BLOCKTIME"] = "30"
os.environ["KMP_SETTINGS"] = "1"
os.environ["KMP_AFFINITY"] = "granularity=fine,verbose,compact,1,0"

# ==================================================================================
# Training and prediction with random batches of clouds

cloud_dir = data_path / 'clouds'

training6(img_list, pctls, model_func, feat_list_new, data_path, batch, T,
          DROPOUT_RATE, **model_params)

prediction(img_list,
           pctls,
           feat_list_new,
           data_path,
           batch,
           remove_perm=True,
           **model_params)

viz = VizFuncs(viz_params)
viz.metric_plots()
viz.cir_image()
viz.time_plot()
viz.false_map()
viz.metric_plots_multi()
viz.time_size()
예제 #2
0
    'saline_lake_sed', 'alluv_coastal_sed_fine', 'coastal_sed_coarse',
    'GSW_distSeasonal', 'aspect', 'curve', 'elevation', 'hand', 'slope', 'spi',
    'twi', 'sti', 'GSW_perm', 'flooded'
]

img_list = ['4337_LC08_026038_20160325_1']

viz_params = {
    'img_list': img_list,
    'pctls': pctls,
    'data_path': data_path,
    'batch': batch,
    'feat_list_new': feat_list_new
}
viz = VizFuncs(viz_params)
viz.cir_image(overwrite=True)


# Doesn't work very well for CIR images - water and dry earth are both turqoise.
def hist_equalize_cir(img,
                      view_hist=False,
                      view_img=False,
                      std_low=1.75,
                      std_high=1.75,
                      save=False):
    spectra_stack_path = data_path / 'images' / img / 'stack' / 'spectra_stack.tif'
    band_combo_dir = data_path / 'band_combos'
    cir_file = band_combo_dir / '{}'.format(img + '_cir_img' + '.png')

    with rasterio.open(spectra_stack_path, 'r') as f:
        nir, red, green = f.read(5), f.read(4), f.read(3)