Skip to content

🦀 My collecrion of various best practices and how to's for Rust 🦀

Notifications You must be signed in to change notification settings

Kataglyphis/Kataglyphis-RustProjectTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

106 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

🦀 Kataglyphis-RustProjectTemplate 🦀

Collecting Rust best practices.

Rust workflow on Ubuntu-24.04 (x86_64/ARM) Rust workflow on Windows 2025 CodeQL

For official docs follow this link.

Donate Twitter

Table of Contents

About The Project

This project is about collecting experience in Rust.

Key Features

  • Features are to be adjusted to your own project needs.
Category Feature Implement Status
Packaging agnostic Binary only deployment ✔️
Lore ipsum ✔️
Lore ipsum agnostic
LORE IPSUM ✔️
Advanced unit testing 🔶
Advanced performance testing 🔶
Advanced fuzz testing 🔶

Legend:

  • ✔️ - completed
  • 🔶 - in progress
  • ❌ - not started

Dependencies

This enumeration also includes submodules.

If you just want the newest versions allowed by your current constraints (updates Cargo.lock only):

Update all:

cargo update

Update versions in Cargo.toml
cargo install cargo-edit
cargo upgrade --dry-run --verbose
cargo upgrade --incompatible

Useful tools

Getting Started

Prerequisites

Installation

  1. Clone the repo
    git clone --recurse-submodules git@github.com:Kataglyphis/Kataglyphis-RustProjectTemplate.git

Tests

Run

cargo run -- read --path ../README.md

Windows: GStreamer + ONNX Overlay (WGPU)

Build + Run (CPU via tract):

cargo run --bin kataglyphis_rustprojecttemplate --features gui_windows,onnx_tract -- gui --backend dx12

Build + Run (ONNX Runtime + DirectML):

cargo run --bin kataglyphis_rustprojecttemplate --features gui_windows,onnxruntime_directml -- gui --backend dx12

Build + Run (ONNX Runtime + CUDA, NVIDIA):

# PowerShell
$env:KATAGLYPHIS_ORT_DEVICE="cuda"
cargo run --bin kataglyphis_rustprojecttemplate --features gui_windows,onnxruntime_cuda -- gui --backend dx12

# CMD
set KATAGLYPHIS_ORT_DEVICE=cuda
cargo run --bin kataglyphis_rustprojecttemplate --features gui_windows,onnxruntime_cuda -- gui --backend dx12

Optional environment variables:

  • KATAGLYPHIS_ONNX_MODEL – Pfad zum ONNX-Modell (Default: models/yolov10m.onnx)
  • KATAGLYPHIS_ONNX_BACKENDtract oder ort (Default: automatisch)
  • KATAGLYPHIS_ORT_DEVICEcpu | auto | cuda (Default: cpu)
  • KATAGLYPHIS_PREPROCESSletterbox | stretch (Default: stretch)
  • KATAGLYPHIS_SWAP_XY – setze 1, falls die Modell-Ausgabe X/Y vertauscht (Default: 0)
  • KATAGLYPHIS_SCORE_THRESHOLD – Score-Schwelle für Erkennung (Default: 0.5)
  • KATAGLYPHIS_INFER_EVERY_MS – Inferenz-Intervall in ms (Default: 100, 0 = jedes Frame)

CUDA Hinweise:

  • Benötigt NVIDIA-Treiber + CUDA/cuDNN Runtime auf dem System.
  • Wenn CUDA-Init fehlschlägt, kann KATAGLYPHIS_ORT_DEVICE=auto genutzt werden (fällt auf CPU zurück).

Overlay:

  • Zeigt FPS, Inferenz-Latenz, CPU/RSS und eine CPU-Historie.
  • Inferenz kann im Overlay ein-/ausgeschaltet werden.

Resource usage logging (CPU/GPU/RAM)

cargo run --features gui_windows,onnxruntime_directml -- --resource-log --resource-log-interval-ms 1000 --resource-log-gpu=true gui

Optional: zusätzlich in Datei schreiben

cargo run --features gui_windows,onnxruntime_directml -- --resource-log --resource-log-file .\resource.log gui

Burn / PyTorch-Replacement Demos

Diese Demos sind als separates Binary integriert und per Feature gated.

cargo run --features burn_demos --bin burn-demos -- --help

Beispiele:

cargo run --features burn_demos --bin burn-demos -- tensor-demo

cargo run --features burn_demos --bin burn-demos -- linear-regression --epochs 50 --steps-per-epoch 50 --lr 0.02 --batch-size 256

cargo run --features burn_demos --bin burn-demos -- xor --epochs 2000 --lr 0.05

cargo run --features burn_demos --bin burn-demos -- two-moons --epochs 200 --steps-per-epoch 50 --lr 0.01 --batch-size 256

# ONNX Runtime YOLOv10m Demo (Default model: models/yolov10m.onnx)
cargo run --features burn_demos --bin burn-demos -- onnx-yolov10 --runs 1 --print-topk 3

Windows

cargo run --features gui_windows -- gui --backend dx12

# Vulkan backend
cargo run --features gui_windows -- gui --backend vulkan

# Auto-select (wgpu PRIMARY)
cargo run --features gui_windows -- gui --backend primary

Linux

# WGPU (recommended)
cargo run --features gui_linux -- gui --backend vulkan

# GTK demo
cargo run --features gui_unix -- gui

Docs

cargo doc --open

Updates

How to update all installed packages:

  1. Install updater:
cargo install cargo-update
  1. Now update all packages:
cargo install-update -a

Cameras

sudo v4l2-ctl --list-formats-ext -d /dev/video0
gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! autovideosink
gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480,framerate=30/1 ! autovideosink

Roadmap

Upcoming :)

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Contact

Jonas Heinle - @Cataglyphis_ - jonasheinle@googlemail.com

Project Link: https://github.com/Kataglyphis/...

Acknowledgements

Literature

Some very helpful literature, tutorials, etc.

About

🦀 My collecrion of various best practices and how to's for Rust 🦀

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published