Doodleverse / doodleverse_utils

A set of common Doodleverse tools and utilities
MIT License
4 stars 3 forks source link

`make_ndwi_dataset` and `make_mndwi_dataset` still use padding, not resizing #14

Closed dbuscombe-usgs closed 2 years ago

dbuscombe-usgs commented 2 years ago

I'm making NDWI and MNDWI datasets to train a Gym model and just noticed that the functions are out of date

The functions called by the Gym utils script python preprocess_data.py still create padded images, not resized ones. This is no longer consistent with make_nd_datasets used to make 1, 3, and Nd datasets

def do_pad_label(lfile, TARGET_SIZE): and def do_pad_image(f, TARGET_SIZE): need to be changed to be more consistent with the correspinding gym functions def do_resize_label(lfile, TARGET_SIZE): and def do_resize_image(f, TARGET_SIZE):

In fact, this may be an opportunity to make a common set of functions, all housed in doodleverse-utils?

dbuscombe-usgs commented 2 years ago

Another issue is that formulae for MNDWI is incorrect (terms switched in denominator and numerator)

Fixed in https://github.com/Doodleverse/doodleverse_utils/commit/6c8e1adc5443c6ed567f6988580542f1c2e0a6d0

Changes made:

  1. do_resize_label and do_resize_image moved from Gym/make_nd_dataset to doodleverse-utils/imports
  2. do_pad_label and do_pad_image removed from make_ndwi_dataset and make_mndwi_dataset. the above functions called with from .imports import *
  3. images and labels resized not padded, using the exact same codes as gym/make_nd_dataset
  4. mndwi = np.divide(g - swir, g + swir ) is now correct in make_mndwi_dataset
  5. general code cleanup (comment removal, removed uncalled dependencies)

this will require a change to Gym/make_nd_dataset to comment out functions scale, scale_rgb, do_resize_label, and do_resize_image, which will now be called from doodleverse_utils/imports. An additional change is the earlier call to from doodleverse_utils.imports import *