Browse Source

Fix memory usage and add README to example

tags/v0.3.4-rc1
haixuanTao 1 year ago
parent
commit
f6ce04b5ed
2 changed files with 22 additions and 16 deletions
  1. +14
    -14
      examples/rerun-viewer/README.md
  2. +8
    -2
      tool_nodes/dora-rerun/src/main.rs

+ 14
- 14
examples/rerun-viewer/README.md View File

@@ -1,25 +1,25 @@
# Python Dataflow Example

This examples shows how to create and connect dora operators and custom nodes in Python.
This examples shows how to create and connect dora to rerun.

## Overview
This nodes is still experimental and format for passing Images, Bounding boxes, and text are probably going to change in the future.

The [`dataflow.yml`](./dataflow.yml) defines a simple dataflow graph with the following three nodes:
## Getting Started

- a webcam node, that connects to your webcam and feed the dataflow with webcam frame as jpeg compressed bytearray.
- an object detection node, that apply Yolo v5 on the webcam image. The model is imported from Pytorch Hub. The output is the bouding box of each object detected, the confidence and the class. You can have more info here: https://pytorch.org/hub/ultralytics_yolov5/
- a window plotting node, that will retrieve the webcam image and the Yolov5 bounding box and join the two together.
```bash
cargo install --force rerun-cli@0.15.1

## Getting started
## To install this package
git clone git@github.com:dora-rs/dora.git
cargo install --git https://github.com/dora-rs/dora dora-rerun

```bash
cargo run --example python-dataflow
dora start dataflow.yml --attach
```

## Run the dataflow as a standalone
You will see two visualizations. One from matplotlib and one from rerun for comparaison.

- Start the `dora-daemon`:
## CI/CD

```
../../target/release/dora-daemon --run-dataflow dataflow.yml
```
This example is not tested on the CI/CD as visualization is not really testable.
Please reach out in case of issues at: https://github.com/dora-rs/dora/issues

+ 8
- 2
tool_nodes/dora-rerun/src/main.rs View File

@@ -5,7 +5,9 @@ use dora_node_api::{
DoraNode, Event,
};
use eyre::{Context, Result};
use rerun::{external::re_types::ArrowBuffer, TensorBuffer, TensorData, TensorDimension};
use rerun::{
external::re_types::ArrowBuffer, SpawnOptions, TensorBuffer, TensorData, TensorDimension,
};

fn main() -> Result<()> {
// `serve()` requires to have a running Tokio runtime in the current context.
@@ -15,8 +17,12 @@ fn main() -> Result<()> {
let (_node, mut events) =
DoraNode::init_from_env().context("Could not initialize dora node")?;

// Limit memory usage
let mut options = SpawnOptions::default();
options.memory_limit = "25%".into();

let rec = rerun::RecordingStreamBuilder::new("dora-rerun")
.spawn()
.spawn_opts(&options, None)
.context("Could not spawn rerun visualization")?;

while let Some(event) = events.recv() {


Loading…
Cancel
Save