I am using VOC dataset to train Fast-RCNN model using Mindspore, Unfortunatily when I try to convert my dataset to a Mindrecord I get the following error, although 7 mindscore files were created:
WARNING: Logging before InitGoogleLogging() is written to STDERR
[ERROR] DEBUG(11092,2,?):2021-9-19 16:42:53 [mindspore\ccsrc\debug\common.cc:280] SaveStringToFile] Open dump file 'C:\Users\Yaman\PycharmProjects\Mindsporeproject\somas_meta\somas_graph0_17123576251438239986.info' failed!
[ERROR] DEBUG(11092,2,?):2021-9-19 16:42:53 [mindspore\ccsrc\debug\common.cc:280] SaveStringToFile] Open dump file 'C:\Users\Yaman\PycharmProjects\Mindsporeproject\somas_meta\somas_graph0_17123576251438239986.json' failed!
This is the code that I used to convert my datatset into mindrecord:
annos = []
file = pd.read_csv('Training_dataset.csv',header=None)
data=file.values.tolist()
image_files=[]
with open("image_files.csv") as file_name:
image_path = np.loadtxt(file_name, delimiter=",", dtype='str')
image_path = np.delete(image_path, 0, 0)
for img in image_path:
image_files.append(img)
def data_to_mindrecord_byte_image(is_training=True, prefix="fasterrcnn.mindrecord", file_num=8):
"""Create MindRecord file."""
mindrecord_dir = config.mindrecord_dir
mindrecord_path = os.path.join(mindrecord_dir, prefix)
writer = FileWriter(mindrecord_path, file_num)
fasterrcnn_json = {
"image": {"type": "bytes"},
"annotation": {"type": "int32", "shape": [-1, 5]},
}
writer.add_schema(fasterrcnn_json, "fasterrcnn_json")
for i, image_name in zip(data,image_files):
with open(image_name, 'rb') as f:
img = f.read()
annos = np.array(i, dtype=np.int32)
print('hi4')
row = {"image": img, "annotation": annos}
writer.write_raw_data([row])
writer.commit()
image_files snapshot:
['C:/Users/Yaman/PycharmProjects/Mindsporeproject/JPEGImages_train\\001622.jpg', 'C:/Users/Yaman/PycharmProjects/Mindsporeproject/JPEGImages_train\\001622.jpg', 'C:/Users/Yaman/PycharmProjects/Mindsporeproject/JPEGImages_train\\001622.jpg', 'C:/Users/Yaman/PycharmProjects/Mindsporeproject/JPEGImages_train\\001622.jpg',]
where each row contains the image file.
annos snapshot:
[404 374 300 300 9]
[283 375 162 326 9]
[500 375 426 305 9]
[100 374 2 259 9]
where each row contain the x1,y1,x2,y2,object_label for each object in corresponding image.
Can someone tell me how to solve the error?