Add caffe_safe to catch caffe exceptions