First, run_tld is followed by tldexample and finally to the initialization function tldinit
The first key function, bb_scan
Gridded the image, scale the image to 1. 2. ^ [-]; (21 specifications), and create a grid for each Specification
This function has an important method.
Ntuples (that is, repetition) because many points on the grid have the same X, or you can call ntuples ([1 2], [1 2, 3]) in MATLAB. let's see what the answer means.
This function returns a 6 * n matrix. Each column of this matrix represents a window.
1, representing X at the top left of the window
2. Y at the top left of the window
3, representing the bottom right of the window x
4. Y at the bottom right of the window
5. ID of this type
6. Number of windows with the same X number
Feature generation function tldgeneratefeatures
Is to generate a series of random numbers (4 * Number of features) * Number of trees
Initialize trajectory
Record continuous Images
Training Detector
Normalized and target similarity bb_overlap
Calculate the similarity between each normalized window and the target window.
Formula: area/total area of the intersection (0.0 is returned if there is no intersection)
Note that the matrix operation returns a vector. The size is the normalized number. Length (GRID)
The function used to retrieve the image. If there are four parameters, the img_patch will be transformed.
Tldgeneratepositivedata generates positive sample data
The main difference is that positive and negative samples are regarded as positive samples when the bb_overlap> threshold value is used.
There is a coding problem here.
Compare random fetch point size for encoding
For (INT I = 0; I <nfeat; I ++ ){
Index <= 1;
Int fp0 = IMG [off [0] + bBox [0];
Int FP1 = IMG [off [1] + bBox [0];
If (fp0> FP1) {index | = 1 ;}
Off + = 2;
}
(Measure_tree_offset of Fern. cpp)
This function returns a PX representing the encoded matrix. PEX indicates the normalization window closest to the target window (this window is processed and can be used for subsequent training ),
Normalization window closest to the target window
Similar negative samples.
Fern (2 ,......)
Start Training Random Tree
If (Y [I] = 1 ){
If (measure_forest (x) <= thrp) // prevents a feature from occupying a large proportion.
Update (x, 1, 1 );
} Else {
If (measure_forest (x)> = thrn)
Update (x, 0, 1 );
Void Update (double * X, int C, int N ){
For (INT I = 0; I <ntrees; I ++ ){
Int idx = (INT) x [I];
(C = 1 )? NP [I] [idx] + = N: NN [I] [idx] + = N;
If (NP [I] [idx] = 0 ){
Weight [I] [idx] = 0;
} Else {
Weight [I] [idx] = (double) (NP [I] [idx]) /(NP [I] [idx] + NN [I] [idx]); // The positive sample increases the weight of the corresponding position and the confidence level after the set.
}
}
}
Training Samples generate a correct feature set
Tldtrainnn (PEX, NEX, TLD)
TLD. pex = [TLD. pex (:, 1: isin (2) x (:, I) TLD. pex (:, isin (2) + 1: End)]; % the code is to generate a relatively high normalization window through the random species. Put these windows in the feature set.
In the future, we can compare this with the target to determine the position of the target window.