提交 a421f479 编写于 作者: Y yangyaming

Follow comments.

上级 78dae3c5
...@@ -23,8 +23,9 @@ size_t appendWithPermute(const Matrix& inMatrix, ...@@ -23,8 +23,9 @@ size_t appendWithPermute(const Matrix& inMatrix,
size_t outOffset, size_t outOffset,
size_t batchSize, size_t batchSize,
Matrix& outMatrix, Matrix& outMatrix,
PermMode permMode, PermMode permMode) {
bool useGpu) { CHECK_EQ(inMatrix.useGpu(), outMatrix.useGpu());
bool useGpu = inMatrix.useGpu();
if (permMode == kNCHWToNHWC) { if (permMode == kNCHWToNHWC) {
size_t inElementCnt = inMatrix.getElementCnt(); size_t inElementCnt = inMatrix.getElementCnt();
size_t channels = inElementCnt / (height * width * batchSize); size_t channels = inElementCnt / (height * width * batchSize);
...@@ -58,8 +59,9 @@ size_t decomposeWithPermute(const Matrix& inMatrix, ...@@ -58,8 +59,9 @@ size_t decomposeWithPermute(const Matrix& inMatrix,
size_t inOffset, size_t inOffset,
size_t batchSize, size_t batchSize,
Matrix& outMatrix, Matrix& outMatrix,
PermMode permMode, PermMode permMode) {
bool useGpu) { CHECK_EQ(inMatrix.useGpu(), outMatrix.useGpu());
bool useGpu = inMatrix.useGpu();
if (permMode == kNHWCToNCHW) { if (permMode == kNHWCToNCHW) {
size_t outElementCnt = outMatrix.getElementCnt(); size_t outElementCnt = outMatrix.getElementCnt();
size_t channels = outElementCnt / (height * width * batchSize); size_t channels = outElementCnt / (height * width * batchSize);
...@@ -98,17 +100,17 @@ real jaccardOverlap(const NormalizedBBox& bbox1, const NormalizedBBox& bbox2) { ...@@ -98,17 +100,17 @@ real jaccardOverlap(const NormalizedBBox& bbox1, const NormalizedBBox& bbox2) {
real interWidth = interXMax - interXMin; real interWidth = interXMax - interXMin;
real interHeight = interYMax - interYMin; real interHeight = interYMax - interYMin;
real interSize = interWidth * interHeight; real interArea = interWidth * interHeight;
real bboxSize1 = bbox1.getSize(); real bboxArea1 = bbox1.getArea();
real bboxSize2 = bbox2.getSize(); real bboxArea2 = bbox2.getArea();
return interSize / (bboxSize1 + bboxSize2 - interSize); return interArea / (bboxArea1 + bboxArea2 - interArea);
} }
} }
void encodeBBoxWithVar(const NormalizedBBox& priorBBox, void encodeBBoxWithVar(const NormalizedBBox& priorBBox,
const vector<real> priorBBoxVar, const vector<real>& priorBBoxVar,
const NormalizedBBox& gtBBox, const NormalizedBBox& gtBBox,
vector<real>& outVec) { vector<real>& outVec) {
real priorBBoxWidth = priorBBox.getWidth(); real priorBBoxWidth = priorBBox.getWidth();
......
...@@ -40,7 +40,7 @@ struct BBoxBase { ...@@ -40,7 +40,7 @@ struct BBoxBase {
T getCenterY() const { return (yMin + yMax) / 2; } T getCenterY() const { return (yMin + yMax) / 2; }
T getSize() const { return getWidth() * getHeight(); } T getArea() const { return getWidth() * getHeight(); }
// coordinate of bounding box // coordinate of bounding box
T xMin; T xMin;
...@@ -67,8 +67,7 @@ size_t appendWithPermute(const Matrix& inMatrix, ...@@ -67,8 +67,7 @@ size_t appendWithPermute(const Matrix& inMatrix,
size_t outOffset, size_t outOffset,
size_t batchSize, size_t batchSize,
Matrix& outMatrix, Matrix& outMatrix,
PermMode permMode, PermMode permMode);
bool useGpu);
/** /**
* @brief First permute input maxtrix then decompose to output * @brief First permute input maxtrix then decompose to output
...@@ -80,8 +79,7 @@ size_t decomposeWithPermute(const Matrix& inMatrix, ...@@ -80,8 +79,7 @@ size_t decomposeWithPermute(const Matrix& inMatrix,
size_t offset, size_t offset,
size_t batchSize, size_t batchSize,
Matrix& outMatrix, Matrix& outMatrix,
PermMode permMode, PermMode permMode);
bool useGpu);
/** /**
* @brief Compute jaccard overlap between two bboxes. * @brief Compute jaccard overlap between two bboxes.
...@@ -99,7 +97,7 @@ real jaccardOverlap(const NormalizedBBox& bbox1, const NormalizedBBox& bbox2); ...@@ -99,7 +97,7 @@ real jaccardOverlap(const NormalizedBBox& bbox1, const NormalizedBBox& bbox2);
* @param outVec Output vector * @param outVec Output vector
*/ */
void encodeBBoxWithVar(const NormalizedBBox& priorBBox, void encodeBBoxWithVar(const NormalizedBBox& priorBBox,
const vector<real> priorBBoxVar, const vector<real>& priorBBoxVar,
const NormalizedBBox& gtBBox, const NormalizedBBox& gtBBox,
vector<real>& outVec); vector<real>& outVec);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册