未验证 提交 37e3bc16 编写于 作者: O OneYearIsEnough 提交者: GitHub

[Patch] Add stability in training stage (#5378)

* [Patch] Add stability in training stage

* [Patch] Add stability in training stage
上级 dc4602c7
...@@ -35,11 +35,14 @@ class DecodeImage(object): ...@@ -35,11 +35,14 @@ class DecodeImage(object):
def __call__(self, data): def __call__(self, data):
img = data['image'] img = data['image']
if six.PY2: if six.PY2:
assert type(img) is str and len( if not (type(img) is str and len(img) > 0):
img) > 0, "invalid input 'img' in DecodeImage" print("invalid input 'img' in DecodeImage, continue")
return None
else: else:
assert type(img) is bytes and len( if not (type(img) is bytes and len(img) > 0):
img) > 0, "invalid input 'img' in DecodeImage" print("invalid input 'img' in DecodeImage, continue")
return None
img = np.frombuffer(img, dtype='uint8') img = np.frombuffer(img, dtype='uint8')
img = cv2.imdecode(img, 1) img = cv2.imdecode(img, 1)
if img is None: if img is None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册