public class Yolo2OutputLayer extends AbstractLayer<Yolo2OutputLayer> implements Serializable, IOutputLayer
Layer.TrainingMode, Layer.Type
Modifier and Type | Field and Description |
---|---|
protected INDArray |
labels |
cacheMode, conf, dropoutApplied, epochCount, index, input, inputModificationAllowed, iterationCount, maskArray, maskState, preOutput, trainingListeners
Constructor and Description |
---|
Yolo2OutputLayer(NeuralNetConfiguration conf) |
Modifier and Type | Method and Description |
---|---|
INDArray |
activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the last set input
|
Pair<Gradient,INDArray> |
backpropGradient(INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
void |
clearNoiseWeightParams() |
Layer |
clone() |
void |
computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Update the score
|
double |
computeScore(double fullNetworkL1,
double fullNetworkL2,
boolean training,
LayerWorkspaceMgr workspaceMgr)
Compute score after labels and input have been set.
|
INDArray |
computeScoreForExamples(double fullNetworkL1,
double fullNetworkL2,
LayerWorkspaceMgr workspaceMgr)
Compute the score for each example individually, after labels and input have been set.
|
double |
f1Score(DataSet data)
Sets the input and labels and returns a score for the prediction
wrt true labels
|
double |
f1Score(INDArray examples,
INDArray labels)
Returns the f1 score for the given examples.
|
void |
fit(DataSet data)
Fit the model
|
void |
fit(DataSetIterator iter)
Train the model based on the datasetiterator
|
void |
fit(INDArray examples,
INDArray labels)
Fit the model
|
void |
fit(INDArray examples,
int[] labels)
Fit the model
|
INDArray |
getConfidenceMatrix(INDArray networkOutput,
int example,
int bbNumber)
Get the confidence matrix (confidence for all x/y positions) for the specified bounding box, from the network
output activations array
|
List<DetectedObject> |
getPredictedObjects(INDArray networkOutput,
double threshold) |
INDArray |
getProbabilityMatrix(INDArray networkOutput,
int example,
int classNumber)
Get the probability matrix (probability of the specified class, assuming an object is present, for all x/y
positions), from the network output activations array
|
Pair<Gradient,Double> |
gradientAndScore()
Get the gradient and score
|
boolean |
isPretrainLayer()
Returns true if the layer can be trained in an unsupervised/pretrain manner (AE, VAE, etc)
|
INDArray |
labelProbabilities(INDArray examples)
Returns the probabilities for each label
for each example row wise
|
boolean |
needsLabels()
Returns true if labels are required
for this output layer
|
int |
numLabels()
Returns the number of possible labels
|
List<String> |
predict(DataSet dataSet)
Takes in a DataSet of examples
For each row, returns a label
|
int[] |
predict(INDArray examples)
Takes in a list of examples
For each row, returns a label
|
double |
score()
The score for the model
|
activate, addListeners, allowInputModification, applyConstraints, applyDropOutIfNecessary, applyMask, assertInputSet, backpropDropOutIfPresent, batchSize, calcL1, calcL2, clear, conf, feedForwardMaskArray, fit, fit, getConfig, getEpochCount, getGradientsViewArray, getHelper, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, getOptimizer, getParam, gradient, init, input, layerConf, layerId, numParams, numParams, params, paramTable, paramTable, setBackpropGradientsViewArray, setCacheMode, setConf, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, setParam, setParams, setParams, setParamsViewArray, setParamTable, type, update, update
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLabels, setLabels
activate, allowInputModification, calcL1, calcL2, feedForwardMaskArray, getEpochCount, getHelper, getIndex, getInputMiniBatchSize, getIterationCount, getListeners, getMaskArray, setCacheMode, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setIterationCount, setListeners, setListeners, setMaskArray, type
getConfig, getGradientsViewArray, numParams, params, paramTable
addListeners, applyConstraints, batchSize, clear, conf, fit, fit, getGradientsViewArray, getOptimizer, getParam, gradient, init, input, numParams, numParams, params, paramTable, paramTable, setBackpropGradientsViewArray, setConf, setParam, setParams, setParamsViewArray, setParamTable, update, update
protected INDArray labels
public Yolo2OutputLayer(NeuralNetConfiguration conf)
public Pair<Gradient,INDArray> backpropGradient(INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
Layer
backpropGradient
in interface Layer
epsilon
- w^(L+1)*delta^(L+1). Or, equiv: dC/da, i.e., (dC/dz)*(dz/da) = dC/da, where C
is cost function a=sigma(z) is activation.workspaceMgr
- Workspace managerArrayType.ACTIVATION_GRAD
workspace via the workspace managerpublic INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Layer
activate
in interface Layer
training
- training or test modeworkspaceMgr
- Workspace managerArrayType.ACTIVATIONS
workspace via the workspace managerpublic boolean needsLabels()
IOutputLayer
needsLabels
in interface IOutputLayer
public double computeScore(double fullNetworkL1, double fullNetworkL2, boolean training, LayerWorkspaceMgr workspaceMgr)
IOutputLayer
computeScore
in interface IOutputLayer
fullNetworkL1
- L1 regularization term for the entire networkfullNetworkL2
- L2 regularization term for the entire networktraining
- whether score should be calculated at train or test time (this affects things like application of
dropout, etc)public double score()
Model
score
in interface Model
score
in class AbstractLayer<Yolo2OutputLayer>
public void computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Model
computeGradientAndScore
in interface Model
computeGradientAndScore
in class AbstractLayer<Yolo2OutputLayer>
public Pair<Gradient,Double> gradientAndScore()
Model
gradientAndScore
in interface Model
gradientAndScore
in class AbstractLayer<Yolo2OutputLayer>
public INDArray computeScoreForExamples(double fullNetworkL1, double fullNetworkL2, LayerWorkspaceMgr workspaceMgr)
IOutputLayer
computeScoreForExamples
in interface IOutputLayer
fullNetworkL1
- L1 regularization term for the entire network (or, 0.0 to not include regularization)fullNetworkL2
- L2 regularization term for the entire network (or, 0.0 to not include regularization)public double f1Score(DataSet data)
Classifier
f1Score
in interface Classifier
data
- the data to scorepublic double f1Score(INDArray examples, INDArray labels)
Classifier
f1Score
in interface Classifier
examples
- te the examples to classify (one example in each row)labels
- the true labelspublic int numLabels()
Classifier
numLabels
in interface Classifier
public void fit(DataSetIterator iter)
Classifier
fit
in interface Classifier
iter
- the iterator to train onpublic int[] predict(INDArray examples)
Classifier
predict
in interface Classifier
examples
- the examples to classify (one example in each row)public List<String> predict(DataSet dataSet)
Classifier
predict
in interface Classifier
dataSet
- the examples to classifypublic INDArray labelProbabilities(INDArray examples)
Classifier
labelProbabilities
in interface Classifier
examples
- the examples to classify (one example in each row)public void fit(INDArray examples, INDArray labels)
Classifier
fit
in interface Classifier
examples
- the examples to classify (one example in each row)labels
- the example labels(a binary outcome matrix)public void fit(DataSet data)
Classifier
fit
in interface Classifier
data
- the data to train onpublic void fit(INDArray examples, int[] labels)
Classifier
fit
in interface Classifier
examples
- the examples to classify (one example in each row)labels
- the labels for each example (the number of labels must match
the number of rows in the examplepublic boolean isPretrainLayer()
Layer
isPretrainLayer
in interface Layer
public void clearNoiseWeightParams()
clearNoiseWeightParams
in interface Layer
public List<DetectedObject> getPredictedObjects(INDArray networkOutput, double threshold)
public INDArray getConfidenceMatrix(INDArray networkOutput, int example, int bbNumber)
networkOutput
- Network output activationsexample
- Example number, in minibatchbbNumber
- Bounding box numberpublic INDArray getProbabilityMatrix(INDArray networkOutput, int example, int classNumber)
networkOutput
- Network output activationsexample
- Example number, in minibatchclassNumber
- Class numberCopyright © 2018. All rights reserved.