Skip to main content

Crate spacelab_vision

Crate spacelab_vision 

Source
Expand description

deepvision — the CNN forward-pass primitives, the third Phase-8 line.

The building blocks that run a convolutional network over space imagery: conv2d, relu, max_pool2d, dense and softmax. Pure Rust, no_std, libm only — no ML framework, so it links anywhere (embedded / offline) and adds no heavy dependency tree. Tensors are caller-provided row-major f64 slices in HWC layout (height, width, channel); a caller sizes the outputs with conv_out_dim / pool_out_dim.

This is the inference kernel. Loading trained models exported to ONNX is the opt-in onnx module (--features onnx, pure-Rust tract); it pulls a std-only dependency and stays out of the default no_std build.

Re-exports§

pub use nn::BatchNormParams;
pub use nn::Conv2d;
pub use nn::ConvTranspose2d;
pub use nn::add;
pub use nn::batch_norm;
pub use nn::concat_channels;
pub use nn::conv_out_dim;
pub use nn::conv_transpose2d;
pub use nn::conv2d;
pub use nn::dense;
pub use nn::global_avg_pool;
pub use nn::max_pool2d;
pub use nn::pad2d;
pub use nn::pool_out_dim;
pub use nn::relu;
pub use nn::sigmoid;
pub use nn::softmax;
pub use model::Layer;
pub use model::Sequential;
pub use model::weights_from_le_bytes;
pub use graph::Graph;
pub use graph::Node;
pub use graph::Op;
pub use detect::BBox;
pub use detect::decode_box;
pub use detect::generate_anchors;
pub use detect::nms;
pub use onnx::OnnxError;
pub use onnx::OnnxModel;
pub use onnx::threshold_mask;

Modules§

detect
Object-detection post-processing — the head that turns dense per-anchor predictions into a short list of boxes: anchor generation, box decoding, IoU, and non-maximum suppression.
graph
A Graph model — a directed acyclic graph of Op nodes, the generalisation of the linear crate::model::Sequential to networks with skip connections: residual adds (ResNet) and channel concatenations (U-Net).
model
A Sequential model — an ordered stack of Layers run end to end, with the tensor shape and scratch buffers managed for you, plus a little-endian weight-blob loader.
nn
CNN forward-pass primitives on caller-provided row-major f64 tensors (HWC layout).
onnx
Load and run trained ONNX models through tract — the opt-in onnx feature, the bridge from hand-authored crate::nn graphs to networks trained in PyTorch/TensorFlow and exported to ONNX. tract is pure Rust (no C/C++ runtime), but needs std, so the whole path is feature-gated and never enters the default no_std build.