1 unstable release

Uses old Rust 2015

0.1.0 Oct 25, 2015

#129 in #deep-learning

1.5MB
166 lines

Rust FFI wrapper for the Caffe deep learning library.

Requires a caffe built with ajtulloch/caffe:caffe-ffi (https://github.com/ajtulloch/caffe/tree/caffe-ffi) to expose the necessary structures over FFI.

let mut net = caffe::Net::new(Path::new("test-data/lenet.prototxt"),
                              caffe::Phase::Test);
net.copy_trained_layers_from(Path::new("test-data/lenet.caffemodel"));
let mut data_blob = net.blob("data");
let mut ones: Vec<_> = repeat(1.0 as f32)
                       .take(data_blob.len())
                       .collect();
data_blob.set_data(ones.as_mut_slice());
net.forward_prefilled();
let prob_blob = net.blob("prob");
let probs = prob_blob.as_slice();
println!("{:?}", probs.to_vec());
assert_eq!(probs[0], 0.06494621)

Dependencies

~8MB
~145K SLoC