From 2a22d9dcc9b4556befbe595c009c7c9641b4e2b4 Mon Sep 17 00:00:00 2001 From: jonyguo Date: Tue, 23 Jun 2020 22:16:10 +0800 Subject: [PATCH] fix: change field name from 'data' to 'image' in mindrecord which similar with ImageFolderDatasetV2 --- .../ImageNet_Similar_Perf/imagenet/mr_api.py | 6 +++--- mindspore/mindrecord/tools/imagenet_to_mr.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example/cv_to_mindrecord/ImageNet_Similar_Perf/imagenet/mr_api.py b/example/cv_to_mindrecord/ImageNet_Similar_Perf/imagenet/mr_api.py index c8129ec9ff..12272b4faf 100644 --- a/example/cv_to_mindrecord/ImageNet_Similar_Perf/imagenet/mr_api.py +++ b/example/cv_to_mindrecord/ImageNet_Similar_Perf/imagenet/mr_api.py @@ -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 diff --git a/mindspore/mindrecord/tools/imagenet_to_mr.py b/mindspore/mindrecord/tools/imagenet_to_mr.py index e941e76477..0aa870384e 100644 --- a/mindspore/mindrecord/tools/imagenet_to_mr.py +++ b/mindspore/mindrecord/tools/imagenet_to_mr.py @@ -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))