# 编写一个函数,将二进制的均值转换为python的均值 def convert_mean(binMean,npyMean): blob = caffe.proto.caffe_pb2.BlobProto() bin_mean = open(binMean, 'rb' ).read() blob.ParseFromString(bin_mean) arr = np.array( caffe.io.blobproto_to_array(blob) ) npy_mean = arr[0] np.save(npyMean, npy_mean ) # 调用函数转换均值 binMean='examples/cifar10/mean.binaryproto' npyMean='examples/cifar10/mean.npy' convert_mean(binMean,npyMean)
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:caffe Python API 之中值转换 - Python技术站