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

* [Patch] Add stability in training stage

* [Patch] Add stability in training stage
pull/6117/head
OneYearIsEnough 2022-05-01 20:04:20 +08:00 committed by GitHub
parent dc4602c75a
commit 37e3bc1699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -35,11 +35,14 @@ class DecodeImage(object):
def __call__(self, data):
img = data['image']
if six.PY2:
assert type(img) is str and len(
img) > 0, "invalid input 'img' in DecodeImage"
if not (type(img) is str and len(img) > 0):
print("invalid input 'img' in DecodeImage, continue")
return None
else:
assert type(img) is bytes and len(
img) > 0, "invalid input 'img' in DecodeImage"
if not (type(img) is bytes and len(img) > 0):
print("invalid input 'img' in DecodeImage, continue")
return None
img = np.frombuffer(img, dtype='uint8')
img = cv2.imdecode(img, 1)
if img is None: