I am using two text files where each has paths to my validation / training images.
I now want to create a mean.binaryproto out of these images to give into my input layer. However, I only found examples where this is done using a leveldb input layer. I can create my own mean image easily using a python script, but I have no idea how to continue after this, so to say how to write the image as a binaryproto at the end of my script. Are there any pointers?
from PIL import Image
import numpy as np;
#Create mean image function
def create_mean(list_of_images):
for i in range(0,len(list_of_images)):
print list_of_images[i]
if i == 0:
n = np.int32(Image.open(list_of_images[i]));
else:
n = n + np.int32(Image.open(list_of_images[i]));
return np.uint8(np.double(n)/len(list_of_images))
#paths out of textfile,here to simplify as an array , usually comes out of a txt file
#but that's not the issue
list_imgs = ['out.tiff','out2.tiff' ]
avg_img = create_mean(list_imgs)
#Now how to write this into the needed .binaryproto
#.... ?