Skip to content

Commit

Permalink
Misc fixes and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
xnorpx committed Jan 4, 2025
1 parent 4513822 commit f83c446
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
name: build-test-cpu
env:
RUST_BACKTRACE: 1
RUSTFLAGS: -C target-cpu=native
RUSTFLAGS: -C target-cpu=native -D warnings
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
Expand Down
56 changes: 38 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@

<div align="center">
<img src="assets/blue_onyx.gif" alt="blue_onyx"/>
<div style="display: flex; justify-content: space-between;">
<img src="assets/logo_medium.png" alt="blue_onyx" style="width:30%;" />
<img src="assets/demo.jpg" alt="blue_onyx" style="width:60%;" />
</div>

# Object Detection Service

Object detection service written in Rust with Onnx inference engine.
Supports Blue Iris and Agent DVR.

## TL;DR

- Windows only (for now)
- CPU and GPU inference (NVIDIA, AMD and Intel)
- [ONNX Inference](https://github.com/onnx/onnx)
- [Direct ML Endpoint](https://github.com/microsoft/DirectML)
- [RT-DETR-V2 Model](https://github.com/lyuwenyu/RT-DETR/tree/main/rtdetrv2_pytorch)
- [ONNX RT-DETR-V2 Models](https://huggingface.co/xnorpx/rt-detr2-onnx)
Current features:

| Feature | Windows x86_64 | Linux x86_64 |
|---------------------------------------------|:--------------:|:------------:|
| RT-DETR-V2 ONNX Models | 🟢 | 🟢 |
| Yolo 5 ONNX Models (including custom) | 🟢 | 🟢 |
| Run as a service | 🟢 ||
| Docker image || 🟢 |
| CPU Inference | 🟢 | 🟢 |
| AMD GPU Inference | 🟢 ||
| Intel GPU Inference | 🟢 ||
| Nvidia GPU Inference | 🟢 ||
| Coral TPU Inference |||

## Install with THE one mighty oneliner

## Install on Windows with THE one mighty oneliner

```powershell
powershell -NoProfile -Command "curl 'https://github.com/xnorpx/blue-onyx/releases/latest/download/install_latest_blue_onyx.ps1' -o 'install_latest_blue_onyx.ps1'; Unblock-File '.\install_latest_blue_onyx.ps1'; powershell.exe -ExecutionPolicy Bypass -File '.\install_latest_blue_onyx.ps1'"
```
```

## Install service
## Install as service on Windows

**Note: You need to run as administrator to register the service and change the install path and command line arguments for your setup.**
```powershell
Expand All @@ -32,14 +44,22 @@ Verify it is working by going to http://127.0.0.1:32168/

(If you don't want to run blue_onyx as a service you can just run blue_onyx.exe)

## Docker container on Linux

```bash
docker pull ghcr.io/xnorpx/blue-onyx:latest
docker run -d -p 32168:32168 ghcr.io/xnorpx/blue_onyx:latest --log-level debug --port 32168
```

## I don't trust scripts I want to install myself

- Download latest release
- [Download latest release](https://github.com/xnorpx/blue-onyx/releases)
- Unzip
- Download models (blue_onyx.exe --download-model-path .)
- blue_onyx.exe to run service
- test_blue_onyx.exe to test service
- blue_onyx_benchmark.exe for benchmark and model testing
- Run blue_onyx

## Notes on Linux

If you run outside of docker you need to install OpenSSL 3

## Tips

Expand Down Expand Up @@ -82,12 +102,12 @@ Then run in another terminal do 100 requests with 100 ms interval
```bash
test_blue_onyx.exe --number-of-requests 100 --interval 100
```

Test image and save image with boundary box use --image to specify your own image.
```bash
blue_onyx_benchmark.exe --save-image-path .
```

<div align="center">
<img src="assets/dog_bike_car_od.jpg" alt="dog_bike_car_od"/>
<img src="assets/dog_bike_car_od.jpg" alt="dog_bike_car_od"/>
</div>
Binary file added assets/demo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 8 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use serde::Deserialize;
use server::run_server;
use std::{future::Future, path::PathBuf};
use tokio_util::sync::CancellationToken;
use tracing::{info, warn, Level};
use tracing::{info, Level};
pub mod api;
pub mod cli;
pub mod detector;
Expand Down Expand Up @@ -106,17 +106,13 @@ pub fn direct_ml_available() -> bool {
}
#[cfg(windows)]
{
if let Ok(exe_path) = std::env::current_exe() {
let exe_dir = exe_path.parent().unwrap();
let direct_ml_path = exe_dir.join("DirectML.dll");
let direct_ml_available = direct_ml_path.exists();
if !direct_ml_available {
warn!("DirectML.dll not found in the same directory as the executable");
}
return direct_ml_available;
}
warn!("Failed to get current executable path");
false
let Ok(exe_path) = std::env::current_exe() else {
return false;
};
let Some(exe_dir) = exe_path.parent() else {
return false;
};
exe_dir.join("DirectML.dll").exists()
}
}

Expand Down

0 comments on commit f83c446

Please sign in to comment.