How to convert .npy file into .binaryproto?

后端 未结 2 914
天涯浪人
天涯浪人 2021-01-16 04:34

I have created a mean image file using python and saved it into numpy file. I would like to know how I could convert this .npy file into .binaryproto file. I am using this f

2条回答
  •  不思量自难忘°
    2021-01-16 04:48

    You can simply use numpy to creat the .binaryproto and the given caffe io functions

    import caffe
    #avg_img is your numpy array with the average data 
    blob = caffe.io.array_to_blobproto( avg_img)
    with open( mean.binaryproto, 'wb' ) as f :
        f.write( blob.SerializeToString())
    

提交回复
热议问题