yolox demo: cast input dtype to float32 for dtype-sensitive backends (#210)
Browse files
demo.py
CHANGED
@@ -33,7 +33,7 @@ classes = ('person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus',
|
|
33 |
'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush')
|
34 |
|
35 |
def letterbox(srcimg, target_size=(640, 640)):
|
36 |
-
padded_img = np.ones((target_size[0], target_size[1], 3)) * 114.0
|
37 |
ratio = min(target_size[0] / srcimg.shape[0], target_size[1] / srcimg.shape[1])
|
38 |
resized_img = cv.resize(
|
39 |
srcimg, (int(srcimg.shape[1] * ratio), int(srcimg.shape[0] * ratio)), interpolation=cv.INTER_LINEAR
|
|
|
33 |
'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush')
|
34 |
|
35 |
def letterbox(srcimg, target_size=(640, 640)):
|
36 |
+
padded_img = np.ones((target_size[0], target_size[1], 3)).astype(np.float32) * 114.0
|
37 |
ratio = min(target_size[0] / srcimg.shape[0], target_size[1] / srcimg.shape[1])
|
38 |
resized_img = cv.resize(
|
39 |
srcimg, (int(srcimg.shape[1] * ratio), int(srcimg.shape[0] * ratio)), interpolation=cv.INTER_LINEAR
|