Caffe implemetation