A Rust wrapper for Darknet, an open source neural network framework written in C and CUDA.
Currently lacks training functionality as it usually done in python. (PRs are welcome)
Features: - image crate integration.
Put 'data' directory with your project if you plan to use Detections::drawonimage method.
Example:
```rust use darknet::{load_labels, Image, Network}; use std::fs;
fn main() { // Load network & labels let objectlabels = loadlabels("./darknet/data/coco.names").unwrap(); let mut net = Network::load( "./darknet/cfg/yolov3-tiny.cfg", Some("./yolov3-tiny.weights"), false, objectlabels.clone(), ) .unwrap(); let mut img = Image::open("./darknet/data/person.jpg").unwrap(); // Run object detection let detections = net.predict(&mut img, 0.45, 0.3); // Print which objects where found println!("Found: {:?}", detections.getlabels()); // Save detected objects as separate images fs::createdir("./result"); for (label, obj) in detections.cropfrom(&img) { obj.save(&format!("./result/{}.jpg", label)).unwrap(); } // Annotate image with object labels and bboxes detections.drawonimage(&mut img); img.show("IMG"); } ```
You can download .weights files here: (https://pjreddie.com/darknet/yolo/)
Version 0.1.3 fixes some serious memory cleanup bugs, so you are encouraged to upgrade.