From 668d89bbd5319c00be9f648d3db8f61689417d2d Mon Sep 17 00:00:00 2001 From: makaveli <39617050+makaveli10@users.noreply.github.com> Date: Tue, 25 May 2021 18:17:16 +0530 Subject: [PATCH] fix: yolov5 get width (#566) --- yolov5/yolov5.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/yolov5/yolov5.cpp b/yolov5/yolov5.cpp index 6601a63..61cff61 100644 --- a/yolov5/yolov5.cpp +++ b/yolov5/yolov5.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "cuda_utils.h" #include "logging.h" #include "common.hpp" @@ -23,10 +24,8 @@ static Logger gLogger; static int get_width(int x, float gw, int divisor = 8) { //return math.ceil(x / divisor) * divisor - if (int(x * gw) % divisor == 0) { - return int(x * gw); - } - return (int(x * gw / divisor) + 1) * divisor; + + return int(ceil((x * gw) / divisor)) * divisor; } static int get_depth(int x, float gd) {