I have read about the working of transformer on various threads; yet still I didn't find the answer.
I have this in Caffe (in Python 2.7):
transformer = caffe.io.Transformer({'data': np.shape(sketch_net.blobs['data'].data)})
transformer.set_mean('data', np.array([104, 117, 123]))
transformer.set_transpose('data',(2,0,1))
transformer.set_channel_swap('data', (2,1,0))
transformer.set_raw_scale('data', 255.0)
I am unable to understand what the first line does. I have seen people explaining it like:
"Informing the transformer of the necessary input shape" or here in this thread,
https://groups.google.com/d/msg/caffe-users/kVDppVZo3jQ/NBbqOgwiFgAJ, a user said (as I understand it) that if
np.shape(sketch_net.blobs['data'].data) is
(10, 3, 227, 227) then 10 random 227x227 crops are supposed to be extracted from a 256x256 image and passed through the net.
What I actually have as np.shape(sketch_net.blobs['data'].data) is (1, 3, 224, 224), so I expected that it will crop one random 227*227 patch from the image.
Now my questions: - I get the same output, the same scores/euclidean distances every time I run my code. If a random patch is chosen then the output should be different every time (atleast in the decimal part). Why is this happening?
- What happens if the image is ,say, 100*100, what will it crop? It doesn't give any error. So how is it actually working?
I am trying to convert a code from Python to MATLAB (matcaffe) and I am having trouble since I don't understand the first line and there is no such thing as transformer (that I know of) in matcaffe.
Regards,
Ek E.