MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.common.BBoxUtility< T > Class Template Reference

The BBox class processes the NormalizedBBox data used with SSD. More...

Inheritance diagram for MyCaffe.common.BBoxUtility< T >:

Public Member Functions

 BBoxUtility (CudaDnn< T > cuda, Log log)
 The constructor. More...
 
void Dispose ()
 Clean up all resources. More...
 
float ComputeAP (List< Tuple< float, int > > rgTp, int nNumPos, List< Tuple< float, int > > rgFp, ApVersion apVersion, out List< float > rgPrec, out List< float > rgRec)
 Compute the average precision given true positive and false positive vectors. More...
 
List< int > CumSum (List< Tuple< float, int > > rgPairs)
 Calculate the cumulative sum of a set of pairs. More...
 
void ApplyNMSFast (List< NormalizedBBox > rgBBoxes, List< float > rgScores, float fScoreThreshold, float fNmsThreshold, float fEta, int nTopK, out List< int > rgIndices)
 Do a fast non maximum supression given bboxes and scores. More...
 
List< int > ApplyNMS (List< NormalizedBBox > rgBBoxes, List< float > rgScores, float fThreshold, int nTopK)
 Do non maximum supression given bboxes and scores. More...
 
List< int > ApplyNMS (List< NormalizedBBox > rgBBoxes, List< float > rgScores, float fThreshold, int nTopK, bool bReuseOverlaps, out Dictionary< int, Dictionary< int, float > > rgOverlaps)
 Do non maximum supression given bboxes and scores. More...
 
Dictionary< int, Dictionary< int, List< NormalizedBBox > > > GetDetectionResults (float[] rgData, int nNumDet, int nBackgroundLabelId)
 Get detection results from rgData. More...
 
List< NormalizedBBoxGetPrior (float[] rgPriorData, int nNumPriors, out List< List< float > > rgPriorVariances)
 Get the prior boundary boxes from the rgPriorData. More...
 
List< List< float > > ComputeConfLoss (float[] rgConfData, int nNum, int nNumPredsPerClass, int nNumClasses, int nBackgroundLabelId, MultiBoxLossParameter.ConfLossType loss_type)
 Compute the confidence loss for each prior from rgConfData. More...
 
List< List< float > > ComputeConfLoss (float[] rgConfData, int nNum, int nNumPredsPerClass, int nNumClasses, int nBackgroundLabelId, MultiBoxLossParameter.ConfLossType loss_type, List< DictionaryMap< List< int > > > rgAllMatchIndices, DictionaryMap< List< NormalizedBBox > > rgAllGtBoxes)
 Compute the confidence loss for each prior from rgConfData. More...
 
List< List< float > > ComputeConfLoss (float[] rgConfData, int nNum, int nNumPredsPerClass, int nNumClasses, int nBackgroundLabelId, MultiBoxLossParameter.ConfLossType loss_type, List< Dictionary< int, List< int > > > rgAllMatchIndices, Dictionary< int, List< NormalizedBBox > > rgAllGtBoxes)
 Compute the confidence loss for each prior from rgConfData. More...
 
List< Dictionary< int, List< float > > > GetConfidenceScores (float[] rgConfData, int nNum, int nNumPredsPerClass, int nNumClasses)
 Calculate the confidence predictions from rgConfData. More...
 
List< LabelBBoxGetLocPredictions (float[] rgLocData, int nNum, int nNumPredsPerClass, int nNumLocClasses, bool bShareLocation)
 Create a set of local predictions from the rgLocData. More...
 
DictionaryMap< List< NormalizedBBox > > GetGroundTruth (float[] rgGtData, int nNumGt, int nBackgroundLabelId, bool bUseDifficultGt)
 Create a set of ground truth bounding boxes from the rgGtData. More...
 
Dictionary< int, LabelBBoxGetGroundTruthEx (float[] rgGtData, int nNumGt, int nBackgroundLabelId, bool bUseDifficultGt)
 Create a set of ground truth bounding boxes from the rgGtData. More...
 
void Match (List< NormalizedBBox > rgGtBboxes, List< NormalizedBBox > rgPredBboxes, int nLabel, MultiBoxLossParameter.MatchType match_type, float fOverlapThreshold, bool bIgnoreCrossBoundaryBbox, out List< int > rgMatchIndices, out List< float > rgMatchOverlaps)
 Find matches between a list of two bounding boxes. More...
 
bool IsCrossBoundary (NormalizedBBox bbox)
 Returns whether or not the bbox is overlaps outside the range [0,1] More...
 
List< LabelBBoxDecodeAll (List< LabelBBox > rgAllLocPreds, List< NormalizedBBox > rgPriorBboxes, List< List< float > > rgrgfPrioVariances, int nNum, bool bShareLocation, int nNumLocClasses, int nBackgroundLabelId, PriorBoxParameter.CodeType codeType, bool bVarianceEncodedInTarget, bool bClip)
 Decode all bboxes in a batch. More...
 
List< NormalizedBBoxDecode (List< NormalizedBBox > rgPriorBbox, List< List< float > > rgrgfPriorVariance, PriorBoxParameter.CodeType code_type, bool bEncodeVarianceInTarget, bool bClip, List< NormalizedBBox > rgBbox)
 Decode a set of bounding box. More...
 
NormalizedBBox Decode (NormalizedBBox prior_bbox, List< float > rgfPriorVariance, PriorBoxParameter.CodeType code_type, bool bEncodeVarianceInTarget, bool bClip, NormalizedBBox bbox)
 Decode a bounding box. More...
 
NormalizedBBox Encode (NormalizedBBox prior_bbox, List< float > rgfPriorVariance, PriorBoxParameter.CodeType code_type, bool bEncodeVarianceInTarget, NormalizedBBox bbox)
 Encode a bounding box. More...
 
bool MeetEmitConstraint (NormalizedBBox src_bbox, NormalizedBBox bbox, EmitConstraint emit_constraint)
 Check if a bbox meets the emit constraint w.r.t the src_bbox. More...
 
float Coverage (NormalizedBBox bbox1, NormalizedBBox bbox2)
 Compute the coverage of bbox1 by bbox2. More...
 
NormalizedBBox Locate (NormalizedBBox srcBbox, NormalizedBBox bbox)
 Locate bbox in the coordinate system of the source Bbox. More...
 
float JaccardOverlap (NormalizedBBox bbox1, NormalizedBBox bbox2, bool bNormalized=true)
 Calculates the Jaccard overlap between two bounding boxes. More...
 
NormalizedBBox Output (NormalizedBBox bbox, SizeF szImg, ResizeParameter p)
 Output the predicted bbox on the actual image. More...
 
bool Project (NormalizedBBox src, NormalizedBBox bbox, out NormalizedBBox proj_bbox)
 Project one bbox onto another. More...
 
void Extrapolate (ResizeParameter param, int nHeight, int nWidth, NormalizedBBox crop_bbox, NormalizedBBox bbox)
 Extrapolate the transformed bbox if height_scale and width_scale are explicitly provied, and the FIT_SMALL_SIZE resize mode is specified. More...
 
NormalizedBBox Intersect (NormalizedBBox bbox1, NormalizedBBox bbox2)
 Create the intersection of two bounding boxes. More...
 
NormalizedBBox Clip (NormalizedBBox bbox, float fHeight=1.0f, float fWidth=1.0f)
 Clip the BBox to a set range. More...
 
NormalizedBBox Scale (NormalizedBBox bbox, int nHeight, int nWidth)
 Scale the BBox to a set range. More...
 
float Size (NormalizedBBox bbox, bool bNormalized=true)
 Calculate the size of a BBox. More...
 
void FindMatches (List< LabelBBox > rgAllLocPreds, DictionaryMap< List< NormalizedBBox > > rgAllGtBboxes, List< NormalizedBBox > rgPriorBboxes, List< List< float > > rgrgPriorVariances, MultiBoxLossParameter p, out List< DictionaryMap< List< float > > > rgAllMatchOverlaps, out List< DictionaryMap< List< int > > > rgAllMatchIndices)
 Find matches between prediction bboxes and ground truth bboxes. More...
 
int CountNumMatches (List< DictionaryMap< List< int > > > rgAllMatchIndices, int nNum)
 Counts the number of matches in the list of maps. More...
 
bool IsEligibleMining (MultiBoxLossParameter.MiningType miningType, int nMatchIdx, float fMatchOverlap, float fNegOverlap)
 Returns whether or not mining is eligible given the mining type and match index. More...
 
int MineHardExamples (Blob< T > blobConf, List< LabelBBox > rgAllLocPreds, DictionaryMap< List< NormalizedBBox > > rgAllGtBBoxes, List< NormalizedBBox > rgPriorBboxes, List< List< float > > rgrgPriorVariances, List< DictionaryMap< List< float > > > rgAllMatchOverlaps, MultiBoxLossParameter p, List< DictionaryMap< List< int > > > rgAllMatchIndices, List< List< int > > rgAllNegIndices, out int nNumNegs)
 Mine the hard examples from the batch. More...
 
void EncodeLocPrediction (List< LabelBBox > rgAllLocPreds, DictionaryMap< List< NormalizedBBox > > rgAllGtBboxes, List< DictionaryMap< List< int > > > rgAllMatchIndices, List< NormalizedBBox > rgPriorBboxes, List< List< float > > rgrgPriorVariances, MultiBoxLossParameter p, Blob< T > blobLocPred, Blob< T > blobLocGt)
 Encode the localization prediction and ground truth for each matched prior. More...
 
void EncodeConfPrediction (float[] rgfConfData, int nNum, int nNumPriors, MultiBoxLossParameter p, List< DictionaryMap< List< int > > > rgAllMatchIndices, List< List< int > > rgAllNegIndices, DictionaryMap< List< NormalizedBBox > > rgAllGtBBoxes, Blob< T > blobConfPred, Blob< T > blobConfGt)
 Encode the confidence predictions and ground truth for each matched prior. More...
 
List< List< float > > ComputeLocLoss (Blob< T > blobLocPred, Blob< T > blobLocGt, List< DictionaryMap< List< int > > > rgAllMatchIndices, int nNum, int nNumPriors, MultiBoxLossParameter.LocLossType lossType)
 Compute the localization loss per matched prior. More...
 

Detailed Description

The BBox class processes the NormalizedBBox data used with SSD.

See also
SSD: Single Shot MultiBox Detector by Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, Alexander C. Berg, 2016.
GitHub: SSD: Single Shot MultiBox Detector, by weiliu89/caffe, 2016

Definition at line 21 of file BBoxUtility.cs.

Constructor & Destructor Documentation

◆ BBoxUtility()

MyCaffe.common.BBoxUtility< T >.BBoxUtility ( CudaDnn< T >  cuda,
Log  log 
)

The constructor.

Parameters
cudaSpecifies the connection to Cuda and cuDNN.
logSpecifies the output log.

Definition at line 33 of file BBoxUtility.cs.

Member Function Documentation

◆ ApplyNMS() [1/2]

List< int > MyCaffe.common.BBoxUtility< T >.ApplyNMS ( List< NormalizedBBox rgBBoxes,
List< float >  rgScores,
float  fThreshold,
int  nTopK 
)

Do non maximum supression given bboxes and scores.

Parameters
rgBBoxesSpecifies a set of bounding boxes.
rgScoresSpecifies a seto of corresponding confidences.
fThresholdSpecifies the threshold used in non maximum suppression.
nTopKSpecifies the top k picked indices or -1 for all.
Returns
The indices of the bboxes after nms are returned.

Definition at line 312 of file BBoxUtility.cs.

◆ ApplyNMS() [2/2]

List< int > MyCaffe.common.BBoxUtility< T >.ApplyNMS ( List< NormalizedBBox rgBBoxes,
List< float >  rgScores,
float  fThreshold,
int  nTopK,
bool  bReuseOverlaps,
out Dictionary< int, Dictionary< int, float > >  rgOverlaps 
)

Do non maximum supression given bboxes and scores.

Parameters
rgBBoxesSpecifies a set of bounding boxes.
rgScoresSpecifies a seto of corresponding confidences.
fThresholdSpecifies the threshold used in non maximum suppression.
nTopKSpecifies the top k picked indices or -1 for all.
bReuseOverlapsSpecifies whether or not to use and update overlaps (true) or alwasy compute the overlap (false).
rgOverlapsReturns the overlaps between pairs of bboxes if bReuseOverlaps is true.
Returns
The indices of the bboxes after nms are returned.

Definition at line 328 of file BBoxUtility.cs.

◆ ApplyNMSFast()

void MyCaffe.common.BBoxUtility< T >.ApplyNMSFast ( List< NormalizedBBox rgBBoxes,
List< float >  rgScores,
float  fScoreThreshold,
float  fNmsThreshold,
float  fEta,
int  nTopK,
out List< int >  rgIndices 
)

Do a fast non maximum supression given bboxes and scores.

Parameters
rgBBoxesSpecifies a set of bounding boxes.
rgScoresSpecifies a seto of corresponding confidences.
fScoreThresholdSpecifies the score threshold used in non maximum suppression.
fNmsThresholdSpecifies the nms threshold used in non maximum suppression.
fEtaSpecifies the eta value.
nTopKSpecifies the top k picked indices or -1 for all.
rgIndicesReturns the kept indices of bboxes after nms.

Definition at line 263 of file BBoxUtility.cs.

◆ Clip()

NormalizedBBox MyCaffe.common.BBoxUtility< T >.Clip ( NormalizedBBox  bbox,
float  fHeight = 1.0f,
float  fWidth = 1.0f 
)

Clip the BBox to a set range.

Parameters
bboxSpecifies the input bounding box.
fHeightSpecifies the clipping height.
fWidthSpecifies the clipping width.
Returns
A new, clipped NormalizedBBox is returned.

Definition at line 1723 of file BBoxUtility.cs.

◆ ComputeAP()

float MyCaffe.common.BBoxUtility< T >.ComputeAP ( List< Tuple< float, int > >  rgTp,
int  nNumPos,
List< Tuple< float, int > >  rgFp,
ApVersion  apVersion,
out List< float >  rgPrec,
out List< float >  rgRec 
)

Compute the average precision given true positive and false positive vectors.

Parameters
rgTpSpecifies a list of scores and true positive.
nNumPosSpecifies the number of true positives.
rgFpSpecifies a list of scores and false positive.
apVersionSpecifies the different ways of computing the Average Precisions.

Tag: Average Precision

Versions: 11point: The 11-point interpolated average precision, used in VOC2007. MaxIntegral: maximally interpolated AP. Used in VOC2012/ILSVRC. Integral: the natrual integral of the precision-recall curve.

Parameters
rgPrecReturns the computed precisions.
rgRecReturns the computed recalls.
Returns
The Average Precision value is returned.

Definition at line 69 of file BBoxUtility.cs.

◆ ComputeConfLoss() [1/3]

List< List< float > > MyCaffe.common.BBoxUtility< T >.ComputeConfLoss ( float[]  rgConfData,
int  nNum,
int  nNumPredsPerClass,
int  nNumClasses,
int  nBackgroundLabelId,
MultiBoxLossParameter.ConfLossType  loss_type 
)

Compute the confidence loss for each prior from rgConfData.

Parameters
rgConfDataSpecifies the nNum x nNumPredsPerClass * nNumClasses blob of confidence data.
nNumSpecifies the number of images.
nNumPredsPerClassSpecifies the number of predictions per class.
nNumClassesSpecifies the number of classes.
nBackgroundLabelIdSpecifies the background label.
loss_typeSpecifies the loss type used to compute the confidence.
Returns
The confidence loss values are returned with confidence loss per location for each image.

Definition at line 551 of file BBoxUtility.cs.

◆ ComputeConfLoss() [2/3]

List< List< float > > MyCaffe.common.BBoxUtility< T >.ComputeConfLoss ( float[]  rgConfData,
int  nNum,
int  nNumPredsPerClass,
int  nNumClasses,
int  nBackgroundLabelId,
MultiBoxLossParameter.ConfLossType  loss_type,
List< Dictionary< int, List< int > > >  rgAllMatchIndices,
Dictionary< int, List< NormalizedBBox > >  rgAllGtBoxes 
)

Compute the confidence loss for each prior from rgConfData.

Parameters
rgConfDataSpecifies the nNum x nNumPredsPerClass * nNumClasses blob of confidence data.
nNumSpecifies the number of images.
nNumPredsPerClassSpecifies the number of predictions per class.
nNumClassesSpecifies the number of classes.
nBackgroundLabelIdSpecifies the background label.
loss_typeSpecifies the loss type used to compute the confidence.
rgAllMatchIndicesSpecifies all match indices storing a mapping between predictions and ground truth.
rgAllGtBoxesSpecifies all ground truth bboxes from the batch.
Returns
The confidence loss values are returned with confidence loss per location for each image.

Definition at line 657 of file BBoxUtility.cs.

◆ ComputeConfLoss() [3/3]

List< List< float > > MyCaffe.common.BBoxUtility< T >.ComputeConfLoss ( float[]  rgConfData,
int  nNum,
int  nNumPredsPerClass,
int  nNumClasses,
int  nBackgroundLabelId,
MultiBoxLossParameter.ConfLossType  loss_type,
List< DictionaryMap< List< int > > >  rgAllMatchIndices,
DictionaryMap< List< NormalizedBBox > >  rgAllGtBoxes 
)

Compute the confidence loss for each prior from rgConfData.

Parameters
rgConfDataSpecifies the nNum x nNumPredsPerClass * nNumClasses blob of confidence data.
nNumSpecifies the number of images.
nNumPredsPerClassSpecifies the number of predictions per class.
nNumClassesSpecifies the number of classes.
nBackgroundLabelIdSpecifies the background label.
loss_typeSpecifies the loss type used to compute the confidence.
rgAllMatchIndicesSpecifies all match indices storing a mapping between predictions and ground truth.
rgAllGtBoxesSpecifies all ground truth bboxes from the batch.
Returns
The confidence loss values are returned with confidence loss per location for each image.

Definition at line 634 of file BBoxUtility.cs.

◆ ComputeLocLoss()

List< List< float > > MyCaffe.common.BBoxUtility< T >.ComputeLocLoss ( Blob< T >  blobLocPred,
Blob< T >  blobLocGt,
List< DictionaryMap< List< int > > >  rgAllMatchIndices,
int  nNum,
int  nNumPriors,
MultiBoxLossParameter.LocLossType  lossType 
)

Compute the localization loss per matched prior.

Parameters
blobLocPredSpecifies the location prediction results.
blobLocGtSpecifies the encoded location ground truth.
rgAllMatchIndicesSpecifies the mapping between predictions and the ground truth.
nNumSpecifies the number of images in the batch.
nNumPriorsSpecifies the total number of priors.
lossTypeSpecifies the type of localization loss, Smooth_L1 or L2.
Returns
Returns the localization loss for all priors in the batch.

Definition at line 2429 of file BBoxUtility.cs.

◆ CountNumMatches()

int MyCaffe.common.BBoxUtility< T >.CountNumMatches ( List< DictionaryMap< List< int > > >  rgAllMatchIndices,
int  nNum 
)

Counts the number of matches in the list of maps.

Parameters
rgAllMatchIndicesSpecifies the list of match indices.
nNumSpecifies the number of items.
Returns
The total matches found in the number of items is returned.

Definition at line 1902 of file BBoxUtility.cs.

◆ Coverage()

float MyCaffe.common.BBoxUtility< T >.Coverage ( NormalizedBBox  bbox1,
NormalizedBBox  bbox2 
)

Compute the coverage of bbox1 by bbox2.

Parameters
bbox1Specifies the first BBox.
bbox2Specifies the second BBox.
Returns
The coverage of bbox1 by bbox2 is returned.

Definition at line 1489 of file BBoxUtility.cs.

◆ CumSum()

List< int > MyCaffe.common.BBoxUtility< T >.CumSum ( List< Tuple< float, int > >  rgPairs)

Calculate the cumulative sum of a set of pairs.

Parameters
rgPairs
Returns

Definition at line 187 of file BBoxUtility.cs.

◆ Decode() [1/2]

List< NormalizedBBox > MyCaffe.common.BBoxUtility< T >.Decode ( List< NormalizedBBox rgPriorBbox,
List< List< float > >  rgrgfPriorVariance,
PriorBoxParameter.CodeType  code_type,
bool  bEncodeVarianceInTarget,
bool  bClip,
List< NormalizedBBox rgBbox 
)

Decode a set of bounding box.

Parameters
rgPriorBboxSpecifies an list of prior bounding boxs.
rgrgfPriorVarianceSpecifies the list of prior variance (must have 4 elements each of which are > 0).
code_typeSpecifies the code type.
bEncodeVarianceInTargetSpecifies whether or not to encode the variance in the target.
bClipSpecifies to enable/disable the clipping.
rgBboxSpecifies a list of bounding boxs.
Returns
A list of decoded bounding box is returned.

Definition at line 1185 of file BBoxUtility.cs.

◆ Decode() [2/2]

NormalizedBBox MyCaffe.common.BBoxUtility< T >.Decode ( NormalizedBBox  prior_bbox,
List< float >  rgfPriorVariance,
PriorBoxParameter.CodeType  code_type,
bool  bEncodeVarianceInTarget,
bool  bClip,
NormalizedBBox  bbox 
)

Decode a bounding box.

Parameters
prior_bboxSpecifies the prior bounding box.
rgfPriorVarianceSpecifies the prior variance (must have 4 elements each of which are > 0).
code_typeSpecifies the code type.
bEncodeVarianceInTargetSpecifies whether or not to encode the variance in the target.
bClipSpecifies whether or not to enable clip or not.
bboxSpecifies the bounding box.
Returns
The decoded bounding box is returned.

Definition at line 1215 of file BBoxUtility.cs.

◆ DecodeAll()

List< LabelBBox > MyCaffe.common.BBoxUtility< T >.DecodeAll ( List< LabelBBox rgAllLocPreds,
List< NormalizedBBox rgPriorBboxes,
List< List< float > >  rgrgfPrioVariances,
int  nNum,
bool  bShareLocation,
int  nNumLocClasses,
int  nBackgroundLabelId,
PriorBoxParameter.CodeType  codeType,
bool  bVarianceEncodedInTarget,
bool  bClip 
)

Decode all bboxes in a batch.

Parameters
rgAllLocPredsSpecifies the batch of local predictions.
rgPriorBboxesSpecifies the set of prior bboxes.
rgrgfPrioVariancesSpecifies the prior variances.
nNumSpecifies the number of items in the batch.
bShareLocationSpecifies whether or not to share locations.
nNumLocClassesSpecifies the number of local classes.
nBackgroundLabelIdSpecifies the background label.
codeTypeSpecifies the coding type.
bVarianceEncodedInTargetSpecifies whether or not the variance is encoded in the target or not.
bClipSpecifies whether or not to clip.
Returns
The decoded Bboxes are returned.

Definition at line 1142 of file BBoxUtility.cs.

◆ Dispose()

void MyCaffe.common.BBoxUtility< T >.Dispose ( )

Clean up all resources.

Definition at line 43 of file BBoxUtility.cs.

◆ Encode()

NormalizedBBox MyCaffe.common.BBoxUtility< T >.Encode ( NormalizedBBox  prior_bbox,
List< float >  rgfPriorVariance,
PriorBoxParameter.CodeType  code_type,
bool  bEncodeVarianceInTarget,
NormalizedBBox  bbox 
)

Encode a bounding box.

Parameters
prior_bboxSpecifies the prior bounding box.
rgfPriorVarianceSpecifies the prior variance (must have 4 elements each of which are > 0).
code_typeSpecifies the code type.
bEncodeVarianceInTargetSpecifies whether or not to encode the variance in the target.
bboxSpecifies the bounding box.
Returns
The encoded bounding box is returned.

Definition at line 1337 of file BBoxUtility.cs.

◆ EncodeConfPrediction()

void MyCaffe.common.BBoxUtility< T >.EncodeConfPrediction ( float[]  rgfConfData,
int  nNum,
int  nNumPriors,
MultiBoxLossParameter  p,
List< DictionaryMap< List< int > > >  rgAllMatchIndices,
List< List< int > >  rgAllNegIndices,
DictionaryMap< List< NormalizedBBox > >  rgAllGtBBoxes,
Blob< T >  blobConfPred,
Blob< T >  blobConfGt 
)

Encode the confidence predictions and ground truth for each matched prior.

Parameters
rgfConfDataSpecifies the num x num_priors * num_classes blob.
nNumSpecifies the number of images.
nNumPriorsSpecifies the number of priors (predictions) per image.
pSpecifies the parameters for the MultiBoxLossLayer.
rgAllMatchIndicesSpecifies the mapping between predictions and the ground truth.
rgAllNegIndicesSpecifies the indices for negative samples.
rgAllGtBBoxesSpecifies the ground truth bboxes for the batch.
blobConfPredSpecifies the confidence prediction results.
blobConfGtSpecifies the confidence ground truth.

Definition at line 2297 of file BBoxUtility.cs.

◆ EncodeLocPrediction()

void MyCaffe.common.BBoxUtility< T >.EncodeLocPrediction ( List< LabelBBox rgAllLocPreds,
DictionaryMap< List< NormalizedBBox > >  rgAllGtBboxes,
List< DictionaryMap< List< int > > >  rgAllMatchIndices,
List< NormalizedBBox rgPriorBboxes,
List< List< float > >  rgrgPriorVariances,
MultiBoxLossParameter  p,
Blob< T >  blobLocPred,
Blob< T >  blobLocGt 
)

Encode the localization prediction and ground truth for each matched prior.

Parameters
rgAllLocPredsSpecifies the location prediction, where each item contains the location prediction for an image.
rgAllGtBboxesSpecifies the ground truth bboxes for the batch.
rgAllMatchIndicesSpecifies the mapping between predictions and the ground truth.
rgPriorBboxesSpecifies the prior bboxes in the format of NormalizedBBox.
rgrgPriorVariancesSpecifies the variances needed by the prior bboxes.
pSpecifies the parameters for the MultiBoxLossLayer.
blobLocPredSpecifies the location prediction results.
blobLocGtSpecifies the encoded location ground truth.

Definition at line 2195 of file BBoxUtility.cs.

◆ Extrapolate()

void MyCaffe.common.BBoxUtility< T >.Extrapolate ( ResizeParameter  param,
int  nHeight,
int  nWidth,
NormalizedBBox  crop_bbox,
NormalizedBBox  bbox 
)

Extrapolate the transformed bbox if height_scale and width_scale are explicitly provied, and the FIT_SMALL_SIZE resize mode is specified.

Parameters
paramSpecifies the resize parameter.
nHeightSpecifies the height.
nWidthSpecifies the width.
crop_bboxSpecifies the crop Bbox.
bboxSpecifies the Bbox to be updated.

Definition at line 1668 of file BBoxUtility.cs.

◆ FindMatches()

void MyCaffe.common.BBoxUtility< T >.FindMatches ( List< LabelBBox rgAllLocPreds,
DictionaryMap< List< NormalizedBBox > >  rgAllGtBboxes,
List< NormalizedBBox rgPriorBboxes,
List< List< float > >  rgrgPriorVariances,
MultiBoxLossParameter  p,
out List< DictionaryMap< List< float > > >  rgAllMatchOverlaps,
out List< DictionaryMap< List< int > > >  rgAllMatchIndices 
)

Find matches between prediction bboxes and ground truth bboxes.

Parameters
rgAllLocPredsSpecifies the location prediction, where each item contains location prediction for an image.
rgAllGtBboxesSpecifies the ground truth bboxes for the batch.
rgPriorBboxesSpecifies all prior bboxes in the format of NormalizedBBox.
rgrgPriorVariancesSpecifies all the variances needed by prior bboxes.
pSpecifies the parameter for the MultiBoxLossLayer.
rgAllMatchOverlapsReturns the jaccard overlaps between predictions and ground truth.
rgAllMatchIndicesReturns the mapping between predictions and ground truth.

Definition at line 1786 of file BBoxUtility.cs.

◆ GetConfidenceScores()

List< Dictionary< int, List< float > > > MyCaffe.common.BBoxUtility< T >.GetConfidenceScores ( float[]  rgConfData,
int  nNum,
int  nNumPredsPerClass,
int  nNumClasses 
)

Calculate the confidence predictions from rgConfData.

Parameters
rgConfDataSpecifies the nNum x nNumPredsPerClass * nNumClasses blob of confidence data.
nNumSpecifies the number of images.
nNumPredsPerClassSpecifies the number of predictions per class.
nNumClassesSpecifies the number of classes.
Returns
The confidence scores are returned as the confidence predictions which contains a confidence prediction for an image.

Definition at line 760 of file BBoxUtility.cs.

◆ GetDetectionResults()

Dictionary< int, Dictionary< int, List< NormalizedBBox > > > MyCaffe.common.BBoxUtility< T >.GetDetectionResults ( float[]  rgData,
int  nNumDet,
int  nBackgroundLabelId 
)

Get detection results from rgData.

Parameters
rgDataSpecifies a 1 x 1 x nNumDet x 7 blob data.
nNumDetSpecifies the number of detections.
nBackgroundLabelIdSpecifies the label for the background class which is used to do a sanity check so that no detection contains it.
Returns
The detection results are returned for each class from each image.

Definition at line 435 of file BBoxUtility.cs.

◆ GetGroundTruth()

DictionaryMap< List< NormalizedBBox > > MyCaffe.common.BBoxUtility< T >.GetGroundTruth ( float[]  rgGtData,
int  nNumGt,
int  nBackgroundLabelId,
bool  bUseDifficultGt 
)

Create a set of ground truth bounding boxes from the rgGtData.

Parameters
rgGtDataSpecifies the 1 x 1 x nNumGt x 7 blob with ground truth initialization data.
nNumGtSpecifies the number of ground truths.
nBackgroundLabelIdSpecifies the background label.
bUseDifficultGtSpecifies whether or not to use the difficult ground truth.
Returns
A dictionary containing the ground truth's (one per image) is returned with the label of each bbox stored in the NormalizedBBox.

Definition at line 844 of file BBoxUtility.cs.

◆ GetGroundTruthEx()

Dictionary< int, LabelBBox > MyCaffe.common.BBoxUtility< T >.GetGroundTruthEx ( float[]  rgGtData,
int  nNumGt,
int  nBackgroundLabelId,
bool  bUseDifficultGt 
)

Create a set of ground truth bounding boxes from the rgGtData.

Parameters
rgGtDataSpecifies the 1 x 1 x nNumGt x 7 blob with ground truth initialization data.
nNumGtSpecifies the number of ground truths.
nBackgroundLabelIdSpecifies the background label.
bUseDifficultGtSpecifies whether or not to use the difficult ground truth.
Returns
A dictionary containing the ground truths per label is returned.

Definition at line 888 of file BBoxUtility.cs.

◆ GetLocPredictions()

List< LabelBBox > MyCaffe.common.BBoxUtility< T >.GetLocPredictions ( float[]  rgLocData,
int  nNum,
int  nNumPredsPerClass,
int  nNumLocClasses,
bool  bShareLocation 
)

Create a set of local predictions from the rgLocData.

Parameters
rgLocDataSpecifies the nNum x nNumPredsPerClass * nNumLocClasses * 4 blbo with prediction initialization data.
nNumSpecifies the number of images.
nNumPredsPerClassSpecifies the number of predictions per class.
nNumLocClassesSpecifies the number of local classes It is 1 if bShareLocation is true; and it is equal to the number of classes needed to predict otherwise.
bShareLocationSpecifies whether or not to share the location. If true, all classes share the same location prediction.
Returns
A list of created location predictions is returned as a list of LabelBBox items where each item contains a location prediction for the image.

Definition at line 802 of file BBoxUtility.cs.

◆ GetPrior()

List< NormalizedBBox > MyCaffe.common.BBoxUtility< T >.GetPrior ( float[]  rgPriorData,
int  nNumPriors,
out List< List< float > >  rgPriorVariances 
)

Get the prior boundary boxes from the rgPriorData.

Parameters
rgPriorDataSpecifies the prior data as a 1 x 2 x nNumPriors x 4 x 1 blob.
nNumPriorsSpecifies the number of priors.
rgPriorVariancesSpecifies the prior variances need by prior bboxes.
Returns
The prior bbox list is returned.

Definition at line 477 of file BBoxUtility.cs.

◆ Intersect()

Create the intersection of two bounding boxes.

Parameters
bbox1Specifies the first bounding box.
bbox2Specifies the second bounding box.
Returns
The intersection of the two bounding boxes is returned.

Definition at line 1703 of file BBoxUtility.cs.

◆ IsCrossBoundary()

bool MyCaffe.common.BBoxUtility< T >.IsCrossBoundary ( NormalizedBBox  bbox)

Returns whether or not the bbox is overlaps outside the range [0,1]

Parameters
bboxSpecifies the bounding box to test.
Returns
If the bbox overlaps, true is returned, otherwise false is returned.

Definition at line 1111 of file BBoxUtility.cs.

◆ IsEligibleMining()

bool MyCaffe.common.BBoxUtility< T >.IsEligibleMining ( MultiBoxLossParameter.MiningType  miningType,
int  nMatchIdx,
float  fMatchOverlap,
float  fNegOverlap 
)

Returns whether or not mining is eligible given the mining type and match index.

Parameters
miningTypeSpecifies the mining type.
nMatchIdxSpecifies the matching index.
fMatchOverlapSpecifies the matching overlap.
fNegOverlapSpecifies the negative overlap.
Returns
If mining is allowed, true is returned, otherwise false is returned.

Definition at line 1933 of file BBoxUtility.cs.

◆ JaccardOverlap()

float MyCaffe.common.BBoxUtility< T >.JaccardOverlap ( NormalizedBBox  bbox1,
NormalizedBBox  bbox2,
bool  bNormalized = true 
)

Calculates the Jaccard overlap between two bounding boxes.

Parameters
bbox1Specifies the first bounding box.
bbox2Specifies the second bounding box.
bNormalizedSpecifies whether or not the bboxes are normalized or not.
Returns
The Jaccard overlap is returned.

Definition at line 1527 of file BBoxUtility.cs.

◆ Locate()

Locate bbox in the coordinate system of the source Bbox.

Parameters
srcBboxSpecifies the source Bbox.
bboxSpecifies the bbox to locate.
Returns
The bbox located within the source Bbox is returned.

Definition at line 1509 of file BBoxUtility.cs.

◆ Match()

void MyCaffe.common.BBoxUtility< T >.Match ( List< NormalizedBBox rgGtBboxes,
List< NormalizedBBox rgPredBboxes,
int  nLabel,
MultiBoxLossParameter.MatchType  match_type,
float  fOverlapThreshold,
bool  bIgnoreCrossBoundaryBbox,
out List< int >  rgMatchIndices,
out List< float >  rgMatchOverlaps 
)

Find matches between a list of two bounding boxes.

Parameters
rgGtBboxesSpecifies a list of ground truth bounding boxes.
rgPredBboxesSpecifies a list of predicted bounding boxes.
nLabelSpecifies the label.
match_typeSpecifies the matching type.
fOverlapThresholdSpecifies the overlap.
bIgnoreCrossBoundaryBboxSpecifies whether or not to ignore corss boundary bounding boxes.
rgMatchIndicesSpecifies the list where the indexes of matches are placed.
rgMatchOverlapsSpecifies the list where the overlaps of matches are placed.

Definition at line 935 of file BBoxUtility.cs.

◆ MeetEmitConstraint()

bool MyCaffe.common.BBoxUtility< T >.MeetEmitConstraint ( NormalizedBBox  src_bbox,
NormalizedBBox  bbox,
EmitConstraint  emit_constraint 
)

Check if a bbox meets the emit constraint w.r.t the src_bbox.

Parameters
src_bboxSpecifies the source Bbox.
bboxSpecifies the Bbox to check.
emit_constraintSpecifies the emit constraint.
Returns
If the emit constraint is met, true is returned, otherwise false is returned.

Definition at line 1455 of file BBoxUtility.cs.

◆ MineHardExamples()

int MyCaffe.common.BBoxUtility< T >.MineHardExamples ( Blob< T >  blobConf,
List< LabelBBox rgAllLocPreds,
DictionaryMap< List< NormalizedBBox > >  rgAllGtBBoxes,
List< NormalizedBBox rgPriorBboxes,
List< List< float > >  rgrgPriorVariances,
List< DictionaryMap< List< float > > >  rgAllMatchOverlaps,
MultiBoxLossParameter  p,
List< DictionaryMap< List< int > > >  rgAllMatchIndices,
List< List< int > >  rgAllNegIndices,
out int  nNumNegs 
)

Mine the hard examples from the batch.

Parameters
blobConfSpecifies the confidence prediction.
rgAllLocPredsSpecifies the location prediction, where each item contains the location prediction for an image.
rgAllGtBBoxesSpecifies the ground truth bboxes for the batch.
rgPriorBboxesSpecifies the prior bboxes in the format of NormalizedBBox.
rgrgPriorVariancesSpecifies the variances needed by the prior bboxes.
rgAllMatchOverlapsSpecifies the jaccard overlap between predictions and the ground truth.
pSpecifies the parameters for the MultiBoxLossLayer.
rgAllMatchIndicesSpecifies the mapping between predictions and the ground truth.
rgAllNegIndicesSpecifies the indices for negative samples.
nNumNegsSpecifies the numberof negative indices.
Returns
The number of matches is returned.

Definition at line 1966 of file BBoxUtility.cs.

◆ Output()

NormalizedBBox MyCaffe.common.BBoxUtility< T >.Output ( NormalizedBBox  bbox,
SizeF  szImg,
ResizeParameter  p 
)

Output the predicted bbox on the actual image.

Parameters
bboxSpecifies the bbox.
szImgSpecifies the image size.
pSpecifies the resize parameter.
Returns
The predicted bbox is returned.

Definition at line 1557 of file BBoxUtility.cs.

◆ Project()

bool MyCaffe.common.BBoxUtility< T >.Project ( NormalizedBBox  src,
NormalizedBBox  bbox,
out NormalizedBBox  proj_bbox 
)

Project one bbox onto another.

Parameters
srcSpecifies the source bbox.
bboxSpecifies the second bbox.
proj_bboxReturns the projected bbox here.
Returns
The new project bbox is returned if a projection was made, otherwise the original bbox is returned.

Definition at line 1635 of file BBoxUtility.cs.

◆ Scale()

NormalizedBBox MyCaffe.common.BBoxUtility< T >.Scale ( NormalizedBBox  bbox,
int  nHeight,
int  nWidth 
)

Scale the BBox to a set range.

Parameters
bboxSpecifies the input bounding box.
nHeightSpecifies the scaling height.
nWidthSpecifies the scaling width.
Returns
A new, scaled NormalizedBBox is returned.

Definition at line 1741 of file BBoxUtility.cs.

◆ Size()

float MyCaffe.common.BBoxUtility< T >.Size ( NormalizedBBox  bbox,
bool  bNormalized = true 
)

Calculate the size of a BBox.

Parameters
bboxSpecifies the input bounding box.
bNormalizedSpecifies whether or not the bounding box falls within the range [0,1].
Returns
The size of the bounding box is returned.

Definition at line 1759 of file BBoxUtility.cs.


The documentation for this class was generated from the following file: