Skip to main content

Crate ruvector_cnn

Crate ruvector_cnn 

Source
Expand description

CNN Feature Extraction for Image Embeddings

This crate provides pure Rust CNN-based feature extraction with SIMD acceleration. It is designed for CPU-only deployment including WASM environments.

§Features

  • MobileNet-V3 Small/Large backbones
  • SIMD acceleration (AVX2, NEON, WASM SIMD128)
  • INT8 quantization support
  • Pure Rust (no BLAS/OpenCV dependencies)
  • Parallel batch processing with rayon (optional)

§Example

use ruvector_cnn::{CnnEmbedder, EmbeddingConfig};

let embedder = CnnEmbedder::new(EmbeddingConfig::default())?;
let embedding = embedder.extract(&image_data, width, height)?;
println!("Embedding dim: {}", embedding.len());

§Using MobileNet Backbone

use ruvector_cnn::embedding::MobileNetEmbedder;

// Create a MobileNetV3-Small embedder
let embedder = MobileNetEmbedder::v3_small()?;

// Extract features from normalized float tensor (NCHW format)
let features = embedder.extract(&image_tensor, 224, 224)?;
println!("Feature dim: {}", features.len()); // 576 for V3-Small

Modules§

contrastive
Contrastive Learning Module
int8
INT8 quantization module for ADR-091
kernels
INT8 Quantized Kernels Module
layers
Neural Network Layers
quantize
INT8 Quantization Module (ADR-091)
simd
SIMD Backend Dispatch Module

Structs§

CnnEmbedder
CNN Embedder for feature extraction
EmbeddingConfig
Configuration for CNN embedding extraction
Tensor
A multi-dimensional tensor with NHWC layout

Enums§

CnnError
Errors that can occur during CNN operations.

Traits§

EmbeddingExtractor
Embedding extractor trait

Type Aliases§

CnnResult
Result type for CNN operations.