!47579 fix compare int and float in bounding_box

Merge pull request !47579 from luoyang/issue
This commit is contained in:
i-robot 2023-01-11 07:56:46 +00:00 committed by Gitee
commit e5311e1ecf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 1 deletions

View File

@ -77,7 +77,8 @@ Status BoundingBox::ValidateBoundingBoxes(const TensorRow &image_and_bbox) {
"BoundingBox: bbox width is too large as coordinate x bigger than max num of int64.");
CHECK_FAIL_RETURN_UNEXPECTED((std::numeric_limits<int64_t>::max() - bbox->y()) > bbox->height(),
"BoundingBox: bbox height is too large as coordinate y bigger than max num of int64.");
if ((bbox->x() + bbox->width() > img_w) || (bbox->y() + bbox->height() > img_h)) {
if ((static_cast<int64_t>(bbox->x() + bbox->width()) > img_w) ||
(static_cast<int64_t>(bbox->y() + bbox->height()) > img_h)) {
RETURN_STATUS_ERROR(
StatusCode::kMDBoundingBoxOutOfBounds,
"BoundingBox: bounding boxes is out of bounds of the image, as image width: " + std::to_string(img_w) +