forward
Syntax
Description
[
also computes the activations of the network that you can use for modeling the gradient
loss.features
,activations
] = forward(detector
,dlX
)
Examples
Load a pretrained YOLO v3 object detector.
detector = yolov3ObjectDetector('tiny-yolov3-coco');
Read an image to use for training.
I = imread('highway.png');
Preprocess the training data and convert the preprocessed training data to a formatted dlarray
object.
[Ip,info] = preprocess(detector,I);
Ip = im2single(Ip);
dlX = dlarray(Ip,'SSCB');
Compute the network outputs obtained during training. The forward
function returns the activations from the output layers of the YOLO v3 deep learning network. The first column contains the confidence scores. Columns 2 to 5 contain the bounding box locations computed relative to the grid cell coordinates. The sixth column contains the class probabilities for each class used during training. The seventh and the eighth column contains the prior width and prior height of bounding boxes as computed by the network, respectively. The output features computed during the forward pass are used to model the gradient losses for the network.
[output,activations,state] = forward(detector,dlX)
output=2×8 cell array
{13×13×3 single} {13×13×3 single} {13×13×3 single} {13×13×3 single} {13×13×3 single} {13×13×240 single} {13×13×3 single} {13×13×3 single}
{26×26×3 single} {26×26×3 single} {26×26×3 single} {26×26×3 single} {26×26×3 single} {26×26×240 single} {26×26×3 single} {26×26×3 single}
activations=2×8 cell array
{13×13×3×1 dlarray} {13×13×3×1 dlarray} {13×13×3×1 dlarray} {13×13×3×1 dlarray} {13×13×3×1 dlarray} {13×13×240×1 dlarray} {13×13×3×1 dlarray} {13×13×3×1 dlarray}
{26×26×3×1 dlarray} {26×26×3×1 dlarray} {26×26×3×1 dlarray} {26×26×3×1 dlarray} {26×26×3×1 dlarray} {26×26×240×1 dlarray} {26×26×3×1 dlarray} {26×26×3×1 dlarray}
state=22×3 table
Layer Parameter Value
______________ _________________ __________________
"batch_norm_1" "TrainedMean" {1×1×16 dlarray}
"batch_norm_1" "TrainedVariance" {1×1×16 dlarray}
"batch_norm_2" "TrainedMean" {1×1×32 dlarray}
"batch_norm_2" "TrainedVariance" {1×1×32 dlarray}
"batch_norm_3" "TrainedMean" {1×1×64 dlarray}
"batch_norm_3" "TrainedVariance" {1×1×64 dlarray}
"batch_norm_4" "TrainedMean" {1×1×128 dlarray}
"batch_norm_4" "TrainedVariance" {1×1×128 dlarray}
"batch_norm_5" "TrainedMean" {1×1×256 dlarray}
"batch_norm_5" "TrainedVariance" {1×1×256 dlarray}
"batch_norm_6" "TrainedMean" {1×1×512 dlarray}
"batch_norm_6" "TrainedVariance" {1×1×512 dlarray}
"batch_norm_7" "TrainedMean" {1×1×1024 dlarray}
"batch_norm_7" "TrainedVariance" {1×1×1024 dlarray}
"batch_norm_8" "TrainedMean" {1×1×256 dlarray}
"batch_norm_8" "TrainedVariance" {1×1×256 dlarray}
⋮
Input Arguments
YOLO v3 object detector, specified as a yolov3ObjectDetector
object.
Training data, specified as a formatted dlarray
(Deep Learning Toolbox)
object.
Output Arguments
Output features in box coordinates, returned as an N-by-8 cell array. N is the number of output layers in the YOLO v3 deep learning network.
Activations of the network, returned as an N-by-8 cell array of
formatted dlarray
(Deep Learning Toolbox)
objects. N is the number of output layers in the YOLO v3 deep
learning network.
Each row in the cell array is of form [conf
bx
by
bw
bh
prob
tw
th]. The function returns each activation as a
formatted dlarray
(Deep Learning Toolbox) value.
Activations | Description |
conf | Estimated confidence scores for each bounding box. |
bx | Estimated X-coordinate value for the center of the bounding box relative to the location of the grid cell. |
by | Estimated Y-coordinate value for the center of the bounding box relative to the location of the grid cell. |
bw | Estimated width of the bounding box relative to the location of the grid cell. |
bh | Estimated height of the bounding box relative to the location of the grid cell. |
prob | Class probabilities estimated for each feature in the output feature map. |
tw | Prior width of the bounding box as estimated by the network. |
th | Prior height of the bounding box as estimated by the network. |
Updated network state, returned as a table. The network state is a table with three columns:
Layer
– Layer name, returned as a string scalar.Parameter
– Parameter name, returned as a string scalar.Value
– Value of parameter, returned as a numeric array object.
The network state contains information remembered by the network between iterations.
Version History
Introduced in R2021a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)