提交 1b7a16a8 编写于 作者: littletomatodonkey's avatar littletomatodonkey

fix tia exception

上级 65a472cd
...@@ -309,16 +309,28 @@ def warp(img, ang): ...@@ -309,16 +309,28 @@ def warp(img, ang):
if config.distort: if config.distort:
img_height, img_width = img.shape[0:2] img_height, img_width = img.shape[0:2]
if random.random() <= prob and img_height >= 20 and img_width >= 20: if random.random() <= prob and img_height >= 20 and img_width >= 20:
try:
new_img = tia_distort(new_img, random.randint(3, 6)) new_img = tia_distort(new_img, random.randint(3, 6))
except:
logger.warning(
"Exception occured during tia_distort, pass it...")
if config.stretch: if config.stretch:
img_height, img_width = img.shape[0:2] img_height, img_width = img.shape[0:2]
if random.random() <= prob and img_height >= 20 and img_width >= 20: if random.random() <= prob and img_height >= 20 and img_width >= 20:
try:
new_img = tia_stretch(new_img, random.randint(3, 6)) new_img = tia_stretch(new_img, random.randint(3, 6))
except:
logger.warning(
"Exception occured during tia_stretch, pass it...")
if config.perspective: if config.perspective:
if random.random() <= prob: if random.random() <= prob:
try:
new_img = tia_perspective(new_img) new_img = tia_perspective(new_img)
except:
logger.warning(
"Exception occured during tia_perspective, pass it...")
if config.crop: if config.crop:
img_height, img_width = img.shape[0:2] img_height, img_width = img.shape[0:2]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册