public class Yolo2OutputLayer extends AbstractLayer<Yolo2OutputLayer> implements Serializable, IOutputLayer
Layer.TrainingMode, Layer.Type| Modifier and Type | Field and Description |
|---|---|
protected org.nd4j.linalg.api.ndarray.INDArray |
labels |
cacheMode, conf, dropoutApplied, dropoutMask, epochCount, index, input, iterationCount, maskArray, maskState, preOutput, trainingListeners| Constructor and Description |
|---|
Yolo2OutputLayer(NeuralNetConfiguration conf) |
| Modifier and Type | Method and Description |
|---|---|
org.nd4j.linalg.api.ndarray.INDArray |
activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the last set input
|
org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> |
backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
void |
clearNoiseWeightParams() |
Layer |
clone()
Clone the layer
|
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.
|
org.nd4j.linalg.api.ndarray.INDArray |
computeScoreForExamples(double fullNetworkL1,
double fullNetworkL2,
LayerWorkspaceMgr workspaceMgr)
Compute the score for each example individually, after labels and input have been set.
|
double |
f1Score(org.nd4j.linalg.dataset.api.DataSet data)
Sets the input and labels and returns a score for the prediction
wrt true labels
|
double |
f1Score(org.nd4j.linalg.api.ndarray.INDArray examples,
org.nd4j.linalg.api.ndarray.INDArray labels)
Returns the f1 score for the given examples.
|
void |
fit(org.nd4j.linalg.dataset.api.DataSet data)
Fit the model
|
void |
fit(org.nd4j.linalg.dataset.api.iterator.DataSetIterator iter)
Train the model based on the datasetiterator
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray examples,
org.nd4j.linalg.api.ndarray.INDArray labels)
Fit the model
|
void |
fit(org.nd4j.linalg.api.ndarray.INDArray examples,
int[] labels)
Fit the model
|
org.nd4j.linalg.api.ndarray.INDArray |
getConfidenceMatrix(org.nd4j.linalg.api.ndarray.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(org.nd4j.linalg.api.ndarray.INDArray networkOutput,
double threshold) |
org.nd4j.linalg.api.ndarray.INDArray |
getProbabilityMatrix(org.nd4j.linalg.api.ndarray.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
|
org.nd4j.linalg.primitives.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)
|
org.nd4j.linalg.api.ndarray.INDArray |
labelProbabilities(org.nd4j.linalg.api.ndarray.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(org.nd4j.linalg.dataset.api.DataSet dataSet)
Takes in a DataSet of examples
For each row, returns a label
|
int[] |
predict(org.nd4j.linalg.api.ndarray.INDArray examples)
Takes in a list of examples
For each row, returns a label
|
double |
score()
The score for the model
|
accumulateScore, activate, addListeners, applyConstraints, applyDropOutIfNecessary, applyMask, assertInputSet, batchSize, calcL1, calcL2, clear, conf, feedForwardMaskArray, fit, fit, getGradientsViewArray, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, getOptimizer, getParam, gradient, init, initParams, input, layerConf, layerId, numParams, numParams, params, paramTable, paramTable, setBackpropGradientsViewArray, setCacheMode, setConf, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, setParam, setParams, setParams, setParamsViewArray, setParamTable, transpose, type, update, update, validateInputequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLabels, setLabelsactivate, calcL1, calcL2, feedForwardMaskArray, getEpochCount, getIndex, getInputMiniBatchSize, getIterationCount, getListeners, getMaskArray, setCacheMode, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setIterationCount, setListeners, setListeners, setMaskArray, transpose, typeaccumulateScore, addListeners, applyConstraints, batchSize, clear, conf, fit, fit, getGradientsViewArray, getOptimizer, getParam, gradient, init, initParams, input, numParams, numParams, params, paramTable, paramTable, setBackpropGradientsViewArray, setConf, setParam, setParams, setParamsViewArray, setParamTable, update, update, validateInputpublic Yolo2OutputLayer(NeuralNetConfiguration conf)
public org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
LayerbackpropGradient in interface Layerepsilon - 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 org.nd4j.linalg.api.ndarray.INDArray activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Layeractivate in interface Layertraining - training or test modeworkspaceMgr - Workspace managerArrayType.ACTIVATIONS workspace via the workspace managerpublic Layer clone()
Layerclone in interface Layerclone in class AbstractLayer<Yolo2OutputLayer>public boolean needsLabels()
IOutputLayerneedsLabels in interface IOutputLayerpublic double computeScore(double fullNetworkL1,
double fullNetworkL2,
boolean training,
LayerWorkspaceMgr workspaceMgr)
IOutputLayercomputeScore in interface IOutputLayerfullNetworkL1 - 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()
Modelscore in interface Modelscore in class AbstractLayer<Yolo2OutputLayer>public void computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
ModelcomputeGradientAndScore in interface ModelcomputeGradientAndScore in class AbstractLayer<Yolo2OutputLayer>public org.nd4j.linalg.primitives.Pair<Gradient,Double> gradientAndScore()
ModelgradientAndScore in interface ModelgradientAndScore in class AbstractLayer<Yolo2OutputLayer>public org.nd4j.linalg.api.ndarray.INDArray computeScoreForExamples(double fullNetworkL1,
double fullNetworkL2,
LayerWorkspaceMgr workspaceMgr)
IOutputLayercomputeScoreForExamples in interface IOutputLayerfullNetworkL1 - 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(org.nd4j.linalg.dataset.api.DataSet data)
Classifierf1Score in interface Classifierdata - the data to scorepublic double f1Score(org.nd4j.linalg.api.ndarray.INDArray examples,
org.nd4j.linalg.api.ndarray.INDArray labels)
Classifierf1Score in interface Classifierexamples - te the examples to classify (one example in each row)labels - the true labelspublic int numLabels()
ClassifiernumLabels in interface Classifierpublic void fit(org.nd4j.linalg.dataset.api.iterator.DataSetIterator iter)
Classifierfit in interface Classifieriter - the iterator to train onpublic int[] predict(org.nd4j.linalg.api.ndarray.INDArray examples)
Classifierpredict in interface Classifierexamples - the examples to classify (one example in each row)public List<String> predict(org.nd4j.linalg.dataset.api.DataSet dataSet)
Classifierpredict in interface ClassifierdataSet - the examples to classifypublic org.nd4j.linalg.api.ndarray.INDArray labelProbabilities(org.nd4j.linalg.api.ndarray.INDArray examples)
ClassifierlabelProbabilities in interface Classifierexamples - the examples to classify (one example in each row)public void fit(org.nd4j.linalg.api.ndarray.INDArray examples,
org.nd4j.linalg.api.ndarray.INDArray labels)
Classifierfit in interface Classifierexamples - the examples to classify (one example in each row)labels - the example labels(a binary outcome matrix)public void fit(org.nd4j.linalg.dataset.api.DataSet data)
Classifierfit in interface Classifierdata - the data to train onpublic void fit(org.nd4j.linalg.api.ndarray.INDArray examples,
int[] labels)
Classifierfit in interface Classifierexamples - 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()
LayerisPretrainLayer in interface Layerpublic void clearNoiseWeightParams()
clearNoiseWeightParams in interface Layerpublic List<DetectedObject> getPredictedObjects(org.nd4j.linalg.api.ndarray.INDArray networkOutput, double threshold)
public org.nd4j.linalg.api.ndarray.INDArray getConfidenceMatrix(org.nd4j.linalg.api.ndarray.INDArray networkOutput,
int example,
int bbNumber)
networkOutput - Network output activationsexample - Example number, in minibatchbbNumber - Bounding box numberpublic org.nd4j.linalg.api.ndarray.INDArray getProbabilityMatrix(org.nd4j.linalg.api.ndarray.INDArray networkOutput,
int example,
int classNumber)
networkOutput - Network output activationsexample - Example number, in minibatchclassNumber - Class numberCopyright © 2018. All rights reserved.