Skip to content

Spybh66/the-complete-picture-python

 
 

Repository files navigation

The Complete Picture

This project makes large use of LLMs in its development. Take this as you will.

Running

Without ML support:

cargo run --release

With ML support:

TRT_ENGINE_PATH=./model/model.engine cargo run --release --features ml

If the ml feature is enabled, CUDA and TensorRT native libraries must be available at build time.

Environment Variables

Runtime

Variable Default Purpose
TRT_ENGINE_PATH ./model/model.engine TensorRT engine loaded at runtime when building with --features ml.

Build time

These variables are only relevant when building with --features ml.

Variable Default Purpose
CUDA_HOME auto-detected CUDA installation root.
CUDA_PATH auto-detected Alternate CUDA installation root.
CUDA_INCLUDE_DIR auto-detected Explicit CUDA include directory override.
CUDA_LIB_DIR auto-detected Explicit CUDA library directory override.
TENSORRT_ROOT auto-detected TensorRT installation root.
TENSORRT_INCLUDE_DIR auto-detected Explicit TensorRT include directory override.
TENSORRT_LIB_DIR auto-detected Explicit TensorRT library directory override.
COMPLETEPICTURE_BUILD_VERBOSE unset Enables extra build-script diagnostics when set.

Example:

CUDA_HOME=/usr/local/cuda \
TENSORRT_ROOT=/usr/lib/x86_64-linux-gnu \
TRT_ENGINE_PATH=./model/model.engine \
cargo run --release --features ml

ML Inference

TensorRTEngine::infer_one and TensorRTEngine::infer_batch accept OpenCV Mat frames directly.

The TensorRT path handles:

  • letterboxing to the engine input size
  • BGR to normalized RGB CHW f32 conversion
  • TensorRT inference
  • Rust-side confidence filtering and class-wise NMS

Camera Selection

The preferred API is explicit camera selection by device index or USB port identity.

use crate::camera::{V4l2CameraProperties, V4l2PipelineMode};

let camera = V4l2CameraProperties::from_usb_port("1-3")?
    .with_pipeline_mode(V4l2PipelineMode::Mjpeg);

let (_capture, selection) = camera.open()?;
println!("Camera: {:?}", selection);

If you need to inspect supported modes first:

use crate::camera::V4l2CameraProperties;

let camera = V4l2CameraProperties::from_usb_port("1-3")?;

for mode in camera.list_modes()? {
    println!(
        "{} {}x{} @ {:.3} fps",
        mode.pixel_format,
        mode.width,
        mode.height,
        mode.fps()
    );
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 75.0%
  • C++ 17.7%
  • Shell 5.9%
  • Meson 1.4%