Skip to content

Commit

Permalink
Update names, titles and tags for examples with real data (#2416)
Browse files Browse the repository at this point in the history
Updates the titles, and adds tags to all "python examples with real
data" (a separate PR is needed for the "fake data" examples).

Renames:

| before | after |
| --- | --- |
| arkitscenes | arkit_scenes |
| colmap | structure_from_motion |
| deep_sdf | signed_distance_fields |
| dicom | dicom_mri |
| mp_pose | human_pose_tracking |
| nyud | rgbd |
| opencv_canny | live_camera_edge_detection |
| ros | ros_node |
| segment_anything | segment_anything_model |
| stable_diffusion | depth_guided_stable_diffusion |
| tracking_hf_opencv | detect_and_track_objects |

In order to minimise merge issues, this is best updated and merged
AFTER:
- #2419
- #2420
- #2418
- #2424
- #2426
- #2360

TODO

- [x] Update names script names
- [x] Update any references to the scripts
- [ ] ~~Mirror updates for Rust examples~~ (none of the renamed examples
have rust counterparts)
- [x] Convert tags to list
- [x] Quick typo/grammar pass with pycharm's checker

* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [ ] I've included a screenshot or gif (if applicable)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2416

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/3fb07ee/docs
Examples preview: https://rerun.io/preview/3fb07ee/examples
<!-- pr-link-docs:end -->

---------

Co-authored-by: Antoine Beyeler <[email protected]>
  • Loading branch information
2 people authored and emilk committed Jun 15, 2023
1 parent 3023efe commit 06fa7da
Show file tree
Hide file tree
Showing 60 changed files with 166 additions and 126 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/reusable_build_and_test_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,16 @@ jobs:
with:
path: examples/python/colmap/dataset/
# TODO(jleibs): Derive this key from the invocation below
key: colmap-dataset-colmap-fiat-v0
key: colmap-dataset-colmap-fiat-v1

- name: Generate Embedded RRD file
if: needs.set-config.outputs.RUN_TESTS == 'true'
shell: bash
# If you change the line below you should almost definitely change the `key:` line above by giving it a new, unique name
run: |
mkdir rrd
pip install -r examples/python/colmap/requirements.txt
python3 examples/python/colmap/main.py --dataset colmap_fiat --resize 800x600 --save rrd/colmap_fiat.rrd
pip install -r examples/python/structure_from_motion/requirements.txt
python3 examples/python/structure_from_motion/main.py --dataset colmap_fiat --resize 800x600 --save rrd/colmap_fiat.rrd
# All platforms are currently creating the same rrd file, upload one of them
- name: Save RRD artifact
Expand Down
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[mypy]
files = rerun_py/rerun_sdk/rerun, rerun_py/tests, examples/python
exclude = examples/python/objectron/proto|examples/python/ros
exclude = examples/python/objectron/proto|examples/python/ros_node
namespace_packages = True
show_error_codes = True
strict = True
Expand Down
14 changes: 7 additions & 7 deletions docs/content/howto/ros2-nav-turtlebot.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ covering how to use ROS 2 itself. If you are a Rerun user that is curious about
please consult the [ROS 2 Documentation](https://docs.ros.org/en/humble/index.html) instead.

All of the code for this guide can be found on GitHub in
[rerun/examples/python/ros](https://github.com/rerun-io/rerun/blob/main/examples/python/ros/).
[rerun/examples/python/ros_node](https://github.com/rerun-io/rerun/blob/main/examples/python/ros_node/).

![Rerun 3D view of ROS 2 turtlebot3 navigation demo](https://static.rerun.io/e51d3e26478661d11b339de5fdfed4f95d07c53c_ros1_preview.png)

Expand Down Expand Up @@ -56,26 +56,26 @@ you should do so now:
git clone [email protected]:rerun-io/rerun.git
cd rerun
```
The example code can be found in the folder: `examples/python/ros`.
The example code can be found in the folder: `examples/python/ros_node`.

In addition to the ROS dependencies, the Rerun node makes use of some dependencies specified in
[`requirements.txt`](https://github.com/rerun-io/rerun/blob/main/examples/python/ros/requirements.txt).
[`requirements.txt`](https://github.com/rerun-io/rerun/blob/main/examples/python/ros_node/requirements.txt).

Rerun recommends using `venv` (or the equivalent) to create an environment for installing these
dependencies. Note that *after* setting up your virtualenv you will need to activate your ROS2
environment.
```bash
$ python3 -m venv venv
$ source venv/bin/active
(venv) $ pip install -r examples/python/ros/requirements.txt
(venv) $ pip install -r examples/python/ros_node/requirements.txt
(venv) $ source /opt/ros/humble/setup.bash
```

## Running the example

With the previous dependencies installed, and gazebo running, you should now be able to launch the Rerun ROS example:
```bash
(venv) $ python3 examples/python/ros/main.py
(venv) $ python3 examples/python/ros_node/main.py
```

You should see a window similar to:
Expand Down Expand Up @@ -103,7 +103,7 @@ If you are familiar with the turtlebot nav example and rviz, this view will like

## Code Explanation

It may be helpful to open [rerun/examples/python/ros/main.py](https://github.com/rerun-io/rerun/blob/main/examples/python/ros/main.py)
It may be helpful to open [rerun/examples/python/ros_node/main.py](https://github.com/rerun-io/rerun/blob/main/examples/python/ros_node/main.py)
to follow along.

Outside of TF, the node is mostly stateless. At a very high level, for each ROS message we are interested in, we create a
Expand Down Expand Up @@ -337,7 +337,7 @@ def scan_callback(self, scan: LaserScan) -> None:

### URDF to `log_mesh`
The URDF conversion is actually the most complex operation in this example. As such the functionality
is split out into a separate [rerun/examples/python/ros/rerun_urdf.py](https://github.com/rerun-io/rerun/blob/main/examples/python/ros/rerun_urdf.py)
is split out into a separate [rerun/examples/python/ros_node/rerun_urdf.py](https://github.com/rerun-io/rerun/blob/main/examples/python/ros_node/rerun_urdf.py)
helper.

Loading the URDF from the `/robot_description` topic is relatively straightforward since we use
Expand Down
42 changes: 24 additions & 18 deletions examples/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,40 +97,46 @@ root:
In some of the examples such as [Stable Diffusion](#stable-diffusion), the algorithm is run on-line,
and may benefit from a GPU-enabled PyTorch machine.
children:
- name: arkitscenes
python: python/arkitscenes
- name: arkit_scenes
python: python/arkit_scenes

- name: colmap
python: python/colmap
- name: structure-from-motion
python: python/structure_from_motion

- name: deep-sdf
python: python/deep_sdf
- name: signed-distance-fields
python: python/signed_distance_fields

- name: dicom
python: python/dicom
- name: dicom-mri
python: python/dicom_mri

- name: mp-pose
python: python/mp_pose
- name: human-pose-tracking
python: python/human_pose_tracking

- name: nyud
python: python/nyud
- name: live-camera-edge-detection
python: python/live_camera_edge_detection

- name: rgbd
python: python/rgbd

- name: objectron
python: python/objectron
rust: rust/objectron

- name: ros-node
python: python/ros_node

- name: raw-mesh
python: python/raw_mesh
rust: rust/raw_mesh

- name: segment-anything
python: python/segment_anything
- name: segment-anything-model
python: python/segment_anything_model

- name: stable-diffusion
python: python/stable_diffusion
- name: depth-guided-stable-diffusion
python: python/depth_guided_stable_diffusion

- name: tracking-hf-opencv
python: python/tracking_hf_opencv
- name: detect-and-track-objects
python: python/detect_and_track_objects

- name: face-tracking
python: python/face_tracking
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions examples/python/arkit_scenes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: ARKit Scenes
python: https://github.com/rerun-io/rerun/blob/latest/examples/python/arkit_scenes/main.py
tags: [2D, 3D, depth, mesh, object-detection, pinhole-camera]
---

![arkit_scenes](https://static.rerun.io/b2874c81d4d716fba07b0fb0893da2a909713ef4_arkitscenes.png)

Visualizes the [ARKit_Scenes dataset](https://github.com/apple/ARKitScenes/) using the Rerun SDK.
The dataset contains color+depth images, the reconstructed mesh and labeled bounding boxes around furniture.

Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def main() -> None:
rr.script_add_args(parser)
args = parser.parse_args()

rr.script_setup(args, "arkitscenes")
rr.script_setup(args, "arkit_scenes")
recording_path = ensure_recording_available(args.video_id, args.include_highres)
log_arkit(recording_path, args.include_highres)

Expand Down
10 changes: 0 additions & 10 deletions examples/python/arkitscenes/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions examples/python/deep_sdf/README.md

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Stable Diffusion
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/stable_diffusion/main.py
title: Depth Guided Stable Diffusion
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/depth_guided_stable_diffusion/main.py
tags: [2D, depth, huggingface, stable-diffusion, tensor, text]
---

![stable_diffusion example>](https://static.rerun.io/baa0cc2f1f1c991a7c6823560524cc1c9d6f11f1_stable_diffusion1.png)
Expand All @@ -10,6 +11,6 @@ A more elaborate example running Depth Guided Stable Diffusion 2.0.
For more info see [here](https://github.com/Stability-AI/stablediffusion).

```bash
pip install -r examples/python/stable_diffusion/requirements.txt
python examples/python/stable_diffusion/main.py
pip install -r examples/python/depth_guided_stable_diffusion/requirements.txt
python examples/python/depth_guided_stable_diffusion/main.py
```
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Tracking HF OpenCV
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/tracking_hf_opencv/main.py
title: Detect and Track Objects
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/detect_and_track_objects/main.py
tags: [2D, huggingface, object-detection, object-tracking, opencv]
---

![tracking_hf_opencv example>](https://static.rerun.io/4995d2ec51249accbd287fdaef5debbfe9645a83_tracking_hf_opencv1.png)
Expand All @@ -10,6 +11,6 @@ Another more elaborate example applying simple object detection and segmentation
For more info see [here](https://huggingface.co/docs/transformers/index)

```bash
pip install -r examples/python/tracking_hf_opencv/requirements.txt
python examples/python/tracking_hf_opencv/main.py
pip install -r examples/python/detect_and_track_objects/requirements.txt
python examples/python/detect_and_track_objects/main.py
```
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def main() -> None:
rr.script_add_args(parser)
args = parser.parse_args()

rr.script_setup(args, "tracking_hf_opencv")
rr.script_setup(args, "detect_and_track_objects")

setup_looging()

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: Dicom
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/dicom/main.py
title: Dicom MRI
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/dicom_mri/main.py
tags: [tensor, mri, dicom]
---

![dicom example>](https://static.rerun.io/86b90a1e2eeb1c6a43fc64b32c7e8b81183063fb_dicom1.png)

Example using a [DICOM](https://en.wikipedia.org/wiki/DICOM) MRI scan. This demonstrates the flexible tensor slicing capabilities of the Rerun viewer.

```bash
pip install -r examples/python/dicom/requirements.txt
python examples/python/dicom/main.py
pip install -r examples/python/dicom_mri/requirements.txt
python examples/python/dicom_mri/main.py
```
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def ensure_dataset_downloaded() -> Iterable[Path]:
parser = argparse.ArgumentParser(description="Logs rich data using the Rerun SDK.")
rr.script_add_args(parser)
args = parser.parse_args()
rr.script_setup(args, "dicom")
rr.script_setup(args, "dicom_mri")
dicom_files = ensure_dataset_downloaded()
read_and_log_dicom_dataset(dicom_files)
rr.script_teardown(args)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: MP Pose
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/mp_pose/main.py
title: Human Pose Tracking
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/human_pose_tracking/main.py
tags: [mediapipe, keypoint-detection, 2D, 3D]
---

![mp_pose example>](https://static.rerun.io/2a4d22e4baeb07dd7b8149fb55bc9954b67825c9_mp_pose1.png)

Use the [MediaPipe](https://google.github.io/mediapipe/) Pose solution to detect and track a human pose in video.

```bash
pip install -r examples/python/mp_pose/requirements.txt
python examples/python/mp_pose/main.py
pip install -r examples/python/human_pose_tracking/requirements.txt
python examples/python/human_pose_tracking/main.py
```
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def main() -> None:
rr.script_add_args(parser)

args = parser.parse_args()
rr.script_setup(args, "mp_pose")
rr.script_setup(args, "human_pose_tracking")

video_path = args.video_path # type: str
if not video_path:
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions examples/python/live_camera_edge_detection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Live Camera Edge Detection
python: https://github.com/rerun-io/rerun/blob/latest/examples/python/live_camera_edge_detection/main.py
tags: [2D, canny, live, opencv]
---

Very simple example of capturing from a live camera.

Runs the opencv canny edge detector on the image stream.

NOTE: this example currently runs forever and will eventually exhaust your
system memory. It is advised you run an independent rerun viewer with a memory
limit:
```
rerun --memory-limit 4GB
```

And then connect using:
```
python examples/python/live_camera_edge_detection/main.py --connect
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
Runs the opencv canny edge detector on the image stream.
Known issues:
- The example has 2+ seconds latency on macOS. [#2216](https://github.com/rerun-io/rerun/issues/2216)
NOTE: this example currently runs forever and will eventually exhaust your
system memory. It is advised you run an independent rerun viewer with a memory
limit:
Expand Down Expand Up @@ -75,7 +72,7 @@ def main() -> None:
rr.script_add_args(parser)
args = parser.parse_args()

rr.script_setup(args, "opencv_canny")
rr.script_setup(args, "live_camera_edge_detection")

print(args.connect)

Expand Down
1 change: 1 addition & 0 deletions examples/python/objectron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Objectron
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/objectron/main.py
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/objectron/src/main.rs
tags: [2D, 3D, object-detection, pinhole-camera]
---

![objectron example>](https://static.rerun.io/110824b31a3fe4e23b481d5fe3ed9fef2306027e_objectron1.png)
Expand Down
22 changes: 11 additions & 11 deletions examples/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
-r api_demo/requirements.txt
-r arkitscenes/requirements.txt
-r arkit_scenes/requirements.txt
-r car/requirements.txt
-r clock/requirements.txt
-r colmap/requirements.txt
-r deep_sdf/requirements.txt
-r dicom/requirements.txt
-r depth_guided_stable_diffusion/requirements.txt
-r detect_and_track_objects/requirements.txt
-r dicom_mri/requirements.txt
-r dna/requirements.txt
-r face_tracking/requirements.txt
-r human_pose_tracking/requirements.txt
-r live_camera_edge_detection/requirements.txt
-r minimal/requirements.txt
-r minimal_options/requirements.txt
-r mp_pose/requirements.txt
-r multiprocessing/requirements.txt
-r multithreading/requirements.txt
-r notebook/requirements.txt
-r nyud/requirements.txt
-r objectron/requirements.txt
-r opencv_canny/requirements.txt
-r plots/requirements.txt
-r raw_mesh/requirements.txt
-r ros/requirements.txt
-r segment_anything/requirements.txt
-r stable_diffusion/requirements.txt
-r rgbd/requirements.txt
-r ros_node/requirements.txt
-r segment_anything_model/requirements.txt
-r signed_distance_fields/requirements.txt
-r structure_from_motion/requirements.txt
-r text_logging/requirements.txt
-r tracking_hf_opencv/requirements.txt
File renamed without changes.
Loading

0 comments on commit 06fa7da

Please sign in to comment.