# img2ofrecord.pyimport cv2
import oneflow.core.record.record_pb2 as ofrecord
import six
import struct
import os
import argparse
import json
#将python内置类型数据转为Feature对象的函数,下同defint32_feature(value):ifnotisinstance(value,(list,tuple)):
value =[value]return ofrecord.Feature(int32_list=ofrecord.Int32List(value=value))defint64_feature(value):ifnotisinstance(value,(list,tuple)):
value =[value]return ofrecord.Feature(int64_list=ofrecord.Int64List(value=value))deffloat_feature(value):ifnotisinstance(value,(list,tuple)):
value =[value]return ofrecord.Feature(float_list=ofrecord.FloatList(value=value))defdouble_feature(value):ifnotisinstance(value,(list,tuple