forked from mindspore-Ecosystem/mindspore
!661 fix imagenet to mindrecord fail when the pic size is 0
Merge pull request !661 from guozhijian/fix_imagenet_to_mindrecord_fail
This commit is contained in:
commit
e8172b3e8f
|
@ -111,6 +111,9 @@ class ImageNetToMR:
|
||||||
image_file = open(file_name, "rb")
|
image_file = open(file_name, "rb")
|
||||||
image_bytes = image_file.read()
|
image_bytes = image_file.read()
|
||||||
image_file.close()
|
image_file.close()
|
||||||
|
if not image_bytes:
|
||||||
|
logger.warning("The image file: {} is invalid.".format(file_name))
|
||||||
|
continue
|
||||||
data["data"] = image_bytes
|
data["data"] = image_bytes
|
||||||
yield data
|
yield data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue