Class VGG16ImagePreProcessor
- java.lang.Object
-
- org.nd4j.linalg.dataset.api.preprocessor.VGG16ImagePreProcessor
-
- All Implemented Interfaces:
Serializable,DataSetPreProcessor,DataNormalization,Normalizer<DataSet>
public class VGG16ImagePreProcessor extends Object implements DataNormalization
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static INDArrayVGG_MEAN_OFFSET_BGRstatic INDArrayVGG_MEAN_OFFSET_BGR_FLOATstatic INDArrayVGG_MEAN_OFFSET_BGR_FLOAT16
-
Constructor Summary
Constructors Constructor Description VGG16ImagePreProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfit(DataSet dataSet)Fit a dataset (only compute based on the statistics from this dataset0voidfit(DataSetIterator iterator)Iterates over a dataset accumulating statistics for normalizationvoidfitLabel(boolean fitLabels)Flag to specify if the labels/outputs in the dataset should be also normalized.protected static INDArraygetMeanFor(INDArray features)NormalizerTypegetType()Get the enum opType of this normalizerbooleanisFitLabel()Whether normalization for the labels is also enabled.voidpreProcess(INDArray features)voidpreProcess(DataSet toPreProcess)Pre process a datasetvoidrevert(DataSet toRevert)Undo (revert) the normalization applied by this DataNormalization instance (arrays are modified in-place)voidrevertFeatures(INDArray features)Undo (revert) the normalization applied by this DataNormalization instance to the specified features arrayvoidrevertFeatures(INDArray features, INDArray featuresMask)Undo (revert) the normalization applied by this DataNormalization instance to the specified features arrayvoidrevertLabels(INDArray labels)Undo (revert) the normalization applied by this DataNormalization instance to the specified labels array.voidrevertLabels(INDArray labels, INDArray labelsMask)Undo (revert) the normalization applied by this DataNormalization instance to the specified labels array.voidtransform(INDArray features)Transform the datasetvoidtransform(INDArray features, INDArray featuresMask)Transform the features, with an optional mask arrayvoidtransform(DataSet toPreProcess)Transform the datavoidtransformLabel(INDArray label)Transform the labels.voidtransformLabel(INDArray labels, INDArray labelsMask)Transform the labels.
-
-
-
Method Detail
-
fit
public void fit(DataSet dataSet)
Fit a dataset (only compute based on the statistics from this dataset0- Specified by:
fitin interfaceNormalizer<DataSet>- Parameters:
dataSet- the dataset to compute on
-
fit
public void fit(DataSetIterator iterator)
Iterates over a dataset accumulating statistics for normalization- Specified by:
fitin interfaceDataNormalization- Parameters:
iterator- the iterator to use for collecting statistics.
-
preProcess
public void preProcess(DataSet toPreProcess)
Description copied from interface:DataSetPreProcessorPre process a dataset- Specified by:
preProcessin interfaceDataNormalization- Specified by:
preProcessin interfaceDataSetPreProcessor- Parameters:
toPreProcess- the data set to pre process
-
preProcess
public void preProcess(INDArray features)
-
transform
public void transform(DataSet toPreProcess)
Transform the data- Specified by:
transformin interfaceNormalizer<DataSet>- Parameters:
toPreProcess- the dataset to transform
-
transform
public void transform(INDArray features)
Description copied from interface:DataNormalizationTransform the dataset- Specified by:
transformin interfaceDataNormalization- Parameters:
features- the features to pre process
-
transform
public void transform(INDArray features, INDArray featuresMask)
Description copied from interface:DataNormalizationTransform the features, with an optional mask array- Specified by:
transformin interfaceDataNormalization- Parameters:
features- the features to pre processfeaturesMask- the mask array to pre process
-
transformLabel
public void transformLabel(INDArray label)
Description copied from interface:DataNormalizationTransform the labels. IfDataNormalization.isFitLabel()== false, this is a no-op- Specified by:
transformLabelin interfaceDataNormalization
-
transformLabel
public void transformLabel(INDArray labels, INDArray labelsMask)
Description copied from interface:DataNormalizationTransform the labels. IfDataNormalization.isFitLabel()== false, this is a no-op- Specified by:
transformLabelin interfaceDataNormalization
-
revert
public void revert(DataSet toRevert)
Description copied from interface:NormalizerUndo (revert) the normalization applied by this DataNormalization instance (arrays are modified in-place)- Specified by:
revertin interfaceNormalizer<DataSet>- Parameters:
toRevert- DataSet to revert the normalization on
-
getType
public NormalizerType getType()
Description copied from interface:NormalizerGet the enum opType of this normalizer- Specified by:
getTypein interfaceNormalizer<DataSet>- Returns:
- the opType
- See Also:
NormalizerSerializerStrategy.getSupportedType()
-
revertFeatures
public void revertFeatures(INDArray features)
Description copied from interface:DataNormalizationUndo (revert) the normalization applied by this DataNormalization instance to the specified features array- Specified by:
revertFeaturesin interfaceDataNormalization- Parameters:
features- Features to revert the normalization on
-
revertFeatures
public void revertFeatures(INDArray features, INDArray featuresMask)
Description copied from interface:DataNormalizationUndo (revert) the normalization applied by this DataNormalization instance to the specified features array- Specified by:
revertFeaturesin interfaceDataNormalization- Parameters:
features- Features to revert the normalization on
-
revertLabels
public void revertLabels(INDArray labels)
Description copied from interface:DataNormalizationUndo (revert) the normalization applied by this DataNormalization instance to the specified labels array. If labels normalization is disabled (i.e.,#isFitLabels()== false) then this is a no-op. Can also be used to undo normalization for network output arrays, in the case of regression.- Specified by:
revertLabelsin interfaceDataNormalization- Parameters:
labels- Labels array to revert the normalization on
-
revertLabels
public void revertLabels(INDArray labels, INDArray labelsMask)
Description copied from interface:DataNormalizationUndo (revert) the normalization applied by this DataNormalization instance to the specified labels array. If labels normalization is disabled (i.e.,#isFitLabels()== false) then this is a no-op. Can also be used to undo normalization for network output arrays, in the case of regression.- Specified by:
revertLabelsin interfaceDataNormalization- Parameters:
labels- Labels array to revert the normalization onlabelsMask- Labels mask array (may be null)
-
fitLabel
public void fitLabel(boolean fitLabels)
Description copied from interface:DataNormalizationFlag to specify if the labels/outputs in the dataset should be also normalized. Default value is usually false.- Specified by:
fitLabelin interfaceDataNormalization
-
isFitLabel
public boolean isFitLabel()
Description copied from interface:DataNormalizationWhether normalization for the labels is also enabled. Most commonly used for regression, not classification.- Specified by:
isFitLabelin interfaceDataNormalization- Returns:
- True if labels will be
-
-