UTIL IMG_NORM - WHOIGit/ifcb_classifier Wiki

Calculating MEAN and STD for --img-norm

Intensity normalization is the act of normalizing overall pixel values in multiple images into the same statistical distribution. By standardizing the input range of each pixel in an image, a neural net can more easily perform gradient descent to find good weights.

neuston_util.py CALC_IMG_NORM allows a user to calculate the MEAN and STD values of a given SRC Dataset. Dataset Directories and Dataset Config CSVs are both accepted, as well as other dataset modifying runtime flags. Depending on the memory available on your system, you may need to adjust the --batch-size flag. This process runs on the CPU.

Resultant MEAN and STD values are output to the terminal stdout.

Example Usage

neuston_util.py CALC_IMG_NORM path/to/MyDataset

usage: neuston_util.py CALC_IMG_NORM [-h] [--resize N] [--class-config CSV COL] 
                                     [--class-min MIN] [--class-max MAX] [--batch-size B] SRC

positional arguments:
  SRC

optional arguments:
  -h, --help              show this help message and exit
  --resize N              Default is 299 (for inception_v3)
  --class-config CSV COL  Skip/combine classes as defined by column COL of a CSV configuration file.
  --class-min MIN         Exclude classes with fewer than MIN instances. Default is 2.
  --class-max MAX         Limit classes to a MAX number of instances. If multiple datasets are specified via a
                          dataset-configuration csv, classes from lower-priority datasets are truncated first.
  --batch-size B          Number of images per minibatch