Standardize
Standardize
¤
Bases: Subfunction_Base
A Standardization method which utilizes custom normalization functions and the Keras preprocess_input() functionality in order to normalize intensity value ranges to be suitable for neural networks.
Default mode: "z-score"
Possible modes: ["z-score", "minmax", "grayscale", "tf", "caffe", "torch"]
Mode Descriptions
Mode | Description |
---|---|
"z-score" |
Sample-wise Z-score normalization (also called Z-transformation). |
"minmax" |
Sample-wise scaling to range [0,1]. |
"grayscale" |
Sample-wise scaling to grayscale range [0, 255]. |
"caffe" |
Will convert the images from RGB to BGR, then will zero-center each color channel with respect to the ImageNet dataset, without scaling. (RGB encoding required!) |
"tf" |
Will scale pixels between -1 and 1, sample-wise. (Grayscale/RGB encoding required!) |
"torch" |
Will scale pixels between 0 and 1 and then will normalize each channel with respect to the ImageNet dataset. (RGB encoding required!) |
Reference - Implementation
Keras preprocess_input() for "tf", "caffe", "torch"
https://www.tensorflow.org/api_docs/python/tf/keras/applications/imagenet_utils/preprocess_input
Source code in aucmedi/data_processing/subfunctions/standardize.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
__init__(mode='z-score', per_channel=False, smooth=1e-06)
¤
Initialization function for creating a Standardize Subfunction which can be passed to a DataGenerator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode |
str
|
Selected mode which standardization/normalization technique should be applied. |
'z-score'
|
per_channel |
bool
|
Option to apply standardization per channel instead of across complete image. |
False
|
smooth |
float
|
Smoothing factor to avoid zero devisions (epsilon). |
1e-06
|
Source code in aucmedi/data_processing/subfunctions/standardize.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|