Prepare patches


Script for creating small size patches given a specific patch size and sliding window size. Patches are saved only if at least a certain portion of pixels within the image are annotated to account for class imbalance. This percentage is also specified in the configuration file.

Usage:

python prepare_patches.py –config_file ./setup_files/setup-pprepare.json

parse_prepare_variables(argparse_args)

Parse and merge training variables from a JSON configuration file and command-line arguments.

Parameters

argparse_args (Namespace) – Command-line arguments parsed by argparse.

Returns

Updated arguments

Return type

Dict

prepare_patches(args: Dict)

Create small size patches with the patch size and sliding windiw size given in the prepare_patches configuration file Patches are saved only if at least a certain portion of pixels within the image are annotated to account for class imbalance. This percentage is also specified in the configuration file.

Parameters

args (Dict) – dictionary of all processing arguments

Returns

save the image in the specified folder

Return type

None