未验证 提交 ae224c8d 编写于 作者: D Double_V 提交者: GitHub

Merge pull request #7463 from LDOUBLEV/26_doc

cp #7462
...@@ -225,6 +225,8 @@ class DetResizeForTest(object): ...@@ -225,6 +225,8 @@ class DetResizeForTest(object):
def __call__(self, data): def __call__(self, data):
img = data['image'] img = data['image']
src_h, src_w, _ = img.shape src_h, src_w, _ = img.shape
if sum([src_h, src_w]) < 64:
img = self.image_padding(img)
if self.resize_type == 0: if self.resize_type == 0:
# img, shape = self.resize_image_type0(img) # img, shape = self.resize_image_type0(img)
...@@ -238,6 +240,12 @@ class DetResizeForTest(object): ...@@ -238,6 +240,12 @@ class DetResizeForTest(object):
data['shape'] = np.array([src_h, src_w, ratio_h, ratio_w]) data['shape'] = np.array([src_h, src_w, ratio_h, ratio_w])
return data return data
def image_padding(self, im, value=0):
h, w, c = im.shape
im_pad = np.zeros((max(32, h), max(32, w), c), np.uint8) + value
im_pad[:h, :w, :] = im
return im_pad
def resize_image_type1(self, img): def resize_image_type1(self, img):
resize_h, resize_w = self.image_shape resize_h, resize_w = self.image_shape
ori_h, ori_w = img.shape[:2] # (h, w, c) ori_h, ori_w = img.shape[:2] # (h, w, c)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册