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 INDArray
VGG_MEAN_OFFSET_BGR
static INDArray
VGG_MEAN_OFFSET_BGR_FLOAT
static INDArray
VGG_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 void
fit(DataSet dataSet)
Fit a dataset (only compute based on the statistics from this dataset0void
fit(DataSetIterator iterator)
Iterates over a dataset accumulating statistics for normalizationvoid
fitLabel(boolean fitLabels)
Flag to specify if the labels/outputs in the dataset should be also normalized.protected static INDArray
getMeanFor(INDArray features)
NormalizerType
getType()
Get the enum opType of this normalizerboolean
isFitLabel()
Whether normalization for the labels is also enabled.void
preProcess(INDArray features)
void
preProcess(DataSet toPreProcess)
Pre process a datasetvoid
revert(DataSet toRevert)
Undo (revert) the normalization applied by this DataNormalization instance (arrays are modified in-place)void
revertFeatures(INDArray features)
Undo (revert) the normalization applied by this DataNormalization instance to the specified features arrayvoid
revertFeatures(INDArray features, INDArray featuresMask)
Undo (revert) the normalization applied by this DataNormalization instance to the specified features arrayvoid
revertLabels(INDArray labels)
Undo (revert) the normalization applied by this DataNormalization instance to the specified labels array.void
revertLabels(INDArray labels, INDArray labelsMask)
Undo (revert) the normalization applied by this DataNormalization instance to the specified labels array.void
transform(INDArray features)
Transform the datasetvoid
transform(INDArray features, INDArray featuresMask)
Transform the features, with an optional mask arrayvoid
transform(DataSet toPreProcess)
Transform the datavoid
transformLabel(INDArray label)
Transform the labels.void
transformLabel(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:
fit
in 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:
fit
in interfaceDataNormalization
- Parameters:
iterator
- the iterator to use for collecting statistics.
-
preProcess
public void preProcess(DataSet toPreProcess)
Description copied from interface:DataSetPreProcessor
Pre process a dataset- Specified by:
preProcess
in interfaceDataNormalization
- Specified by:
preProcess
in 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:
transform
in interfaceNormalizer<DataSet>
- Parameters:
toPreProcess
- the dataset to transform
-
transform
public void transform(INDArray features)
Description copied from interface:DataNormalization
Transform the dataset- Specified by:
transform
in interfaceDataNormalization
- Parameters:
features
- the features to pre process
-
transform
public void transform(INDArray features, INDArray featuresMask)
Description copied from interface:DataNormalization
Transform the features, with an optional mask array- Specified by:
transform
in interfaceDataNormalization
- Parameters:
features
- the features to pre processfeaturesMask
- the mask array to pre process
-
transformLabel
public void transformLabel(INDArray label)
Description copied from interface:DataNormalization
Transform the labels. IfDataNormalization.isFitLabel()
== false, this is a no-op- Specified by:
transformLabel
in interfaceDataNormalization
-
transformLabel
public void transformLabel(INDArray labels, INDArray labelsMask)
Description copied from interface:DataNormalization
Transform the labels. IfDataNormalization.isFitLabel()
== false, this is a no-op- Specified by:
transformLabel
in interfaceDataNormalization
-
revert
public void revert(DataSet toRevert)
Description copied from interface:Normalizer
Undo (revert) the normalization applied by this DataNormalization instance (arrays are modified in-place)- Specified by:
revert
in interfaceNormalizer<DataSet>
- Parameters:
toRevert
- DataSet to revert the normalization on
-
getType
public NormalizerType getType()
Description copied from interface:Normalizer
Get the enum opType of this normalizer- Specified by:
getType
in interfaceNormalizer<DataSet>
- Returns:
- the opType
- See Also:
NormalizerSerializerStrategy.getSupportedType()
-
revertFeatures
public void revertFeatures(INDArray features)
Description copied from interface:DataNormalization
Undo (revert) the normalization applied by this DataNormalization instance to the specified features array- Specified by:
revertFeatures
in interfaceDataNormalization
- Parameters:
features
- Features to revert the normalization on
-
revertFeatures
public void revertFeatures(INDArray features, INDArray featuresMask)
Description copied from interface:DataNormalization
Undo (revert) the normalization applied by this DataNormalization instance to the specified features array- Specified by:
revertFeatures
in interfaceDataNormalization
- Parameters:
features
- Features to revert the normalization on
-
revertLabels
public void revertLabels(INDArray labels)
Description copied from interface:DataNormalization
Undo (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:
revertLabels
in interfaceDataNormalization
- Parameters:
labels
- Labels array to revert the normalization on
-
revertLabels
public void revertLabels(INDArray labels, INDArray labelsMask)
Description copied from interface:DataNormalization
Undo (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:
revertLabels
in 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:DataNormalization
Flag to specify if the labels/outputs in the dataset should be also normalized. Default value is usually false.- Specified by:
fitLabel
in interfaceDataNormalization
-
isFitLabel
public boolean isFitLabel()
Description copied from interface:DataNormalization
Whether normalization for the labels is also enabled. Most commonly used for regression, not classification.- Specified by:
isFitLabel
in interfaceDataNormalization
- Returns:
- True if labels will be
-
-