Browse Source

fix: imagenet to mindrecord failed when the pic size is 0

tags/v0.3.0-alpha
jonyguo 5 years ago
parent
commit
b4151efe81
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      mindspore/mindrecord/tools/imagenet_to_mr.py

+ 3
- 0
mindspore/mindrecord/tools/imagenet_to_mr.py View File

@@ -111,6 +111,9 @@ class ImageNetToMR:
image_file = open(file_name, "rb")
image_bytes = image_file.read()
image_file.close()
if not image_bytes:
logger.warning("The image file: {} is invalid.".format(file_name))
continue
data["data"] = image_bytes
yield data



Loading…
Cancel
Save