Skip to content

Commit 668d89b

Browse files
authored
fix: yolov5 get width (wang-xinyu#566)
1 parent d274d90 commit 668d89b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

yolov5/yolov5.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <iostream>
22
#include <chrono>
3+
#include <cmath>
34
#include "cuda_utils.h"
45
#include "logging.h"
56
#include "common.hpp"
@@ -23,10 +24,8 @@ static Logger gLogger;
2324

2425
static int get_width(int x, float gw, int divisor = 8) {
2526
//return math.ceil(x / divisor) * divisor
26-
if (int(x * gw) % divisor == 0) {
27-
return int(x * gw);
28-
}
29-
return (int(x * gw / divisor) + 1) * divisor;
27+
28+
return int(ceil((x * gw) / divisor)) * divisor;
3029
}
3130

3231
static int get_depth(int x, float gd) {

0 commit comments

Comments
 (0)