|
|
@ -100,8 +100,9 @@ void ROIPoolLayer::forward(PassType passType) {
|
|
|
|
size_t roiEndH = round(bottomROIs[4] * spatialScale_);
|
|
|
|
size_t roiEndH = round(bottomROIs[4] * spatialScale_);
|
|
|
|
CHECK_GE(roiBatchIdx, 0UL);
|
|
|
|
CHECK_GE(roiBatchIdx, 0UL);
|
|
|
|
CHECK_LT(roiBatchIdx, batchSize);
|
|
|
|
CHECK_LT(roiBatchIdx, batchSize);
|
|
|
|
size_t roiHeight = std::max(roiEndH - roiStartH + 1, 1UL);
|
|
|
|
size_t roiHeight =
|
|
|
|
size_t roiWidth = std::max(roiEndW - roiStartW + 1, 1UL);
|
|
|
|
std::max(roiEndH - roiStartH + 1, static_cast<size_t>(1));
|
|
|
|
|
|
|
|
size_t roiWidth = std::max(roiEndW - roiStartW + 1, static_cast<size_t>(1));
|
|
|
|
real binSizeH =
|
|
|
|
real binSizeH =
|
|
|
|
static_cast<real>(roiHeight) / static_cast<real>(pooledHeight_);
|
|
|
|
static_cast<real>(roiHeight) / static_cast<real>(pooledHeight_);
|
|
|
|
real binSizeW =
|
|
|
|
real binSizeW =
|
|
|
@ -114,10 +115,14 @@ void ROIPoolLayer::forward(PassType passType) {
|
|
|
|
size_t wstart = static_cast<size_t>(std::floor(pw * binSizeW));
|
|
|
|
size_t wstart = static_cast<size_t>(std::floor(pw * binSizeW));
|
|
|
|
size_t hend = static_cast<size_t>(std::ceil((ph + 1) * binSizeH));
|
|
|
|
size_t hend = static_cast<size_t>(std::ceil((ph + 1) * binSizeH));
|
|
|
|
size_t wend = static_cast<size_t>(std::ceil((pw + 1) * binSizeW));
|
|
|
|
size_t wend = static_cast<size_t>(std::ceil((pw + 1) * binSizeW));
|
|
|
|
hstart = std::min(std::max(hstart + roiStartH, 0UL), height_);
|
|
|
|
hstart = std::min(
|
|
|
|
wstart = std::min(std::max(wstart + roiStartW, 0UL), width_);
|
|
|
|
std::max(hstart + roiStartH, static_cast<size_t>(0)), height_);
|
|
|
|
hend = std::min(std::max(hend + roiStartH, 0UL), height_);
|
|
|
|
wstart = std::min(
|
|
|
|
wend = std::min(std::max(wend + roiStartW, 0UL), width_);
|
|
|
|
std::max(wstart + roiStartW, static_cast<size_t>(0)), width_);
|
|
|
|
|
|
|
|
hend = std::min(std::max(hend + roiStartH, static_cast<size_t>(0)),
|
|
|
|
|
|
|
|
height_);
|
|
|
|
|
|
|
|
wend = std::min(std::max(wend + roiStartW, static_cast<size_t>(0)),
|
|
|
|
|
|
|
|
width_);
|
|
|
|
|
|
|
|
|
|
|
|
bool isEmpty = (hend <= hstart) || (wend <= wstart);
|
|
|
|
bool isEmpty = (hend <= hstart) || (wend <= wstart);
|
|
|
|
size_t poolIndex = ph * pooledWidth_ + pw;
|
|
|
|
size_t poolIndex = ph * pooledWidth_ + pw;
|
|
|
|