提交 a421f479 编写于 作者: Y yangyaming

Follow comments.

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