Hi guys,
I'm very new to Caffe and am trying to train a network on my own data, just to work from the ground up I wanted to view the mean image computed by the compute_image binary that is shipped with Caffe. I am displaying it with the following python:
import caffe
import numpy as np
import sys
import png
from PIL import Image
if len(sys.argv) != 3:
print "Usage: python convert_protomean.py proto.mean out.png"
sys.exit()
blob = caffe.proto.caffe_pb2.BlobProto()
data = open( sys.argv[1] , 'rb' ).read()
blob.ParseFromString(data)
arr = np.array( caffe.io.blobproto_to_array(blob) )
out = arr[0]
print(out.shape)
img = Image.fromarray(out.T, 'RGB')
img.save(sys.argv[2])
However, the image looked like fairly random noise (which could be the case as the dataset is large).
So, just to test I decided to create the mean image from a single image (it should be that same image, correct?)
So I created a directory 'tmp_test' and put one image in there 'apple-0.jpg'.
I created a lmdb dataset using the following command (with the convert_imageset script)
GLOG_logtostderr=1 $TOOLS/convert_imageset \
--resize_height=256 \
--resize_width=256 \
--shuffle \
--backend=lmdb \
$TRAIN_DATA_ROOT \
$DATA/train.txt \
$EXAMPLE/tmp_train_lmdb
which appeared to correctly create the database of 1 image.
I then computed the image mean with the following:
./build/tools/compute_image_mean tmp_test/tmp_train_lmdb \
tmp_test/tmp_mean.binaryproto
I then viewed the file and have attached the input image ('apple-0.jpg') and the mean images
Am I doing something wrong?
Thanks,
Aly