Browse Source

fix: change field name from data to image in mindrecord for imagenet

tags/v0.3.1-alpha
jonyguo 5 years ago
parent
commit
862bc22b38
2 changed files with 6 additions and 6 deletions
  1. +3
    -3
      example/cv_to_mindrecord/ImageNet_Similar_Perf/imagenet/mr_api.py
  2. +3
    -3
      mindspore/mindrecord/tools/imagenet_to_mr.py

+ 3
- 3
example/cv_to_mindrecord/ImageNet_Similar_Perf/imagenet/mr_api.py View File

@@ -26,8 +26,8 @@ import os
import pickle

######## mindrecord_schema begin ##########
mindrecord_schema = {"label": {"type": "int64"},
"data": {"type": "bytes"},
mindrecord_schema = {"label": {"type": "int32"},
"image": {"type": "bytes"},
"file_name": {"type": "string"}}
######## mindrecord_schema end ##########

@@ -121,5 +121,5 @@ def mindrecord_dict_data(task_id):
if not image_bytes:
print("The image file: {} is invalid.".format(file_name))
continue
data["data"] = image_bytes
data["image"] = image_bytes
yield data

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

@@ -114,7 +114,7 @@ class ImageNetToMR:
if not image_bytes:
logger.warning("The image file: {} is invalid.".format(file_name))
continue
data["data"] = image_bytes
data["image"] = image_bytes
yield data

def transform(self):
@@ -126,8 +126,8 @@ class ImageNetToMR:
"""
t0_total = time.time()

imagenet_schema_json = {"label": {"type": "int64"},
"data": {"type": "bytes"},
imagenet_schema_json = {"label": {"type": "int32"},
"image": {"type": "bytes"},
"file_name": {"type": "string"}}

logger.info("transformed MindRecord schema is: {}".format(imagenet_schema_json))


Loading…
Cancel
Save