Skip to content

Commit

Permalink
Open source prep (#11)
Browse files Browse the repository at this point in the history
* Refactor README.md to add structured light support and acknowledgements

* Add support for structured light projection in index.md documentation

* Refactor to improve code readability and maintainability

* Add .github/workflows/docs_deployment.yaml for CI/CD pipeline

* Create LICENSE

* Update version to 1.2.1
  • Loading branch information
aelmiger committed Apr 15, 2024
1 parent 6e7236a commit 6a3b0c1
Show file tree
Hide file tree
Showing 8 changed files with 759 additions and 25 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docs_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: ci

on:
push:
branches:
- master
- main

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x

- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: |
pip install mkdocs-material
pip install mkdocs-glightbox
- name: Build and deploy MkDocs
run: |
cd docs
mkdocs gh-deploy --force
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

---


# 🎯 Features

📷 Photorealistic renderings of the virtual environment with pixel-perfect annotations

📄 No-Code scene and sensor configuration with a simple YAML syntax
Expand All @@ -25,26 +25,26 @@

📦 Easy to use and extend with a modular architecture


# 🔍 Annotations

<div align="center">
<img alt="output-render" src="https://user-images.githubusercontent.com/40243985/222779779-02d4fb4d-b3a9-4436-8d75-b37de437ec10.gif" width="400px"/><br/>
</div>

Syclops supports a variety of annotated outputs for different use cases. The following outputs are currently supported:

|Output|Description|
|:---:|:---:|
|**RGB**|Rendered color image|
|**Semantic Segmentation**|Semantic segmentation mask with class ids|
|**Instance Segmentation**|Unique instance id for each object in the scene|
|**Depth**|Distance from the camera to each pixel|
|**Bounding Boxes**|Bounding boxes for each object in the scene|
|**Object Positions**|3D position of each object in the scene|
|**Point Cloud**|3D location of each pixel in camera space|
|**Keypoints**|Location of keypoints in camera space|
|**Object Volume**|Volume of each object in the scene|

| Output | Description |
| :-----------------------: | :-------------------------------------------------------: |
| **RGB** | Rendered color image |
| **Semantic Segmentation** | Semantic segmentation mask with class ids |
| **Instance Segmentation** | Unique instance id for each object in the scene |
| **Depth** | Distance from the camera to each pixel |
| **Bounding Boxes** | Bounding boxes for each object in the scene |
| **Object Positions** | 3D position of each object in the scene |
| **Point Cloud** | 3D location of each pixel in camera space |
| **Keypoints** | Location of keypoints in camera space |
| **Object Volume** | Volume of each object in the scene |
| **Structured Light** | Projected dot pattern for structured light reconstruction |

# ⚡️Getting Started

Expand Down Expand Up @@ -105,22 +105,24 @@ cd syclops
pip install .
```


## Run a job

Next, the assets need to be crawled by the pipeline. This only needs to be done once, or if new assets are added.

```bash
syclops -c
```

> To run a **job**, a job file is needed. You can find an example in the [syclops/\_\_example_assets\_\_](https://github.com/DFKI-NI/syclops/blob/main/syclops/__example_assets__/example_job.syclops.yaml) folder.
To test the installation with the example job file run:

```bash
syclops --example-job
```

To run a job, simply pass the path to the job file to the `syclops` command:

```bash
syclops -j path/to/job.syclops.yaml
```
Expand All @@ -135,3 +137,7 @@ To quickly visuzalize the data, you can use the dataset viewer tool.
```bash
syclops -da output/2022-09-01_12-00-00
```

# 🙏 Acknowledgements

We would like to thank [@tik0](https://github.com/tik0), [@hwuebben](https://github.com/hwuebben) and [@frahe-ama](https://github.com/frahe-ama) for their valuable feedback during the development of Syclops. Their insightful discussions have played a role in shaping the project and setting its direction. We appreciate the involvement and expertise they have brought to the project.
1 change: 1 addition & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Syclops supports a variety of annotated outputs for different use cases. The fol
|**Point Cloud**|3D location of each pixel in camera space|
|**Keypoints**|Location of keypoints in camera space|
|**Object Volume**|Volume of each object in the scene|
|**Structured Light**| Projected dot pattern for structured light reconstruction|

# 📣 Terminology
|Term|Description|
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme = "README.md"
requires-python = ">=3.8"
license = {text = "GPLv3"}

version = "1.2.0"
version = "1.2.1"

dynamic = ["dependencies"]

Expand Down
1 change: 0 additions & 1 deletion syclops/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import argparse
import os
import subprocess
import time
from datetime import datetime
Expand Down
6 changes: 3 additions & 3 deletions syclops/utility/asset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ def import_file(obj_path: str, imported_objs: List[bpy.types.Object]):
".blend": _import_blend,
}

import_func = import_dispatch.get(extension)
if import_func:
try:
import_func = import_dispatch[extension]
import_func(obj_path)
else:
except KeyError:
raise ValueError(f"Unsupported file extension: {extension}")

new_objects = set(bpy.context.scene.objects) - set(prior_objects)
Expand Down
20 changes: 15 additions & 5 deletions syclops/utility/setup_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
from rich.prompt import Prompt
from ruamel import yaml


def download_file(url: str, dest: Path) -> None:
"""
Download a file from the given URL to the specified destination with rich progress.
"""
with requests.get(url, stream=True) as response:
response.raise_for_status()
total_length = int(response.headers.get('content-length', 0))
total_length = int(response.headers.get("content-length", 0))
task_description = f"[cyan]Downloading {url.split('/')[-1]}...[/cyan]"
with Progress() as progress:
task = progress.add_task(task_description, total=total_length)
Expand All @@ -25,11 +26,12 @@ def download_file(url: str, dest: Path) -> None:
file.write(chunk)
progress.update(task, advance=len(chunk))


def extract_zip(src: Path, dest: Path) -> None:
"""
Extract a zip file with rich progress.
"""
with zipfile.ZipFile(src, 'r') as zip_ref:
with zipfile.ZipFile(src, "r") as zip_ref:
total_files = len(zip_ref.namelist())
task_description = f"[red]Extracting {src.name}...[/red]"
with Progress() as progress:
Expand All @@ -46,7 +48,7 @@ def extract_tar(src: Path, dest: Path) -> None:
"""
Extract a tar.xz file with rich progress.
"""
with tarfile.open(src, 'r:xz') as tar_ref:
with tarfile.open(src, "r:xz") as tar_ref:
total_files = len(tar_ref.getnames())
task_description = f"[red]Extracting {src.name}...[/red]"
with Progress() as progress:
Expand All @@ -58,9 +60,10 @@ def extract_tar(src: Path, dest: Path) -> None:
extracted_folder = dest / src.stem.split(".tar")[0]
extracted_folder.rename(dest / f"blender-{src.stem.split('-')[1]}")


def install_blender(version: str, install_dir: Path) -> None:
"""
Check if Blender is installed in the package directory,
Check if Blender is installed in the package directory,
and if not, download the appropriate version for the OS.
"""
base_url = "https://ftp.halifax.rwth-aachen.de/blender/release/"
Expand Down Expand Up @@ -95,6 +98,7 @@ def install_blender(version: str, install_dir: Path) -> None:
# Clean up
dest_file.unlink()


def get_or_create_install_folder(install_folder_path: str = None) -> Path:
"""
Get the install folder from the config file, or ask the user for a folder.
Expand All @@ -114,7 +118,11 @@ def determine_folder():
return _ask_directory().resolve()

# If 'install_folder' is not in the config or the saved folder doesn't exist
if install_folder_key not in config or not Path(config[install_folder_key]).exists():
if (
install_folder_key not in config
or not Path(config[install_folder_key]).exists()
or install_folder_path is not None
):
install_folder = determine_folder()
config[install_folder_key] = str(install_folder)
_write_config(config)
Expand All @@ -133,10 +141,12 @@ def _load_config() -> dict:
return yaml.safe_load(f)
return {}


def _get_or_create_config_file_path() -> Path:
app_name = "syclops"
return Path(appdirs.user_data_dir(app_name)) / "config.yaml"


def _write_config(config: dict):
config_file = _get_or_create_config_file_path()
# Create the directory if it doesn't exist
Expand Down

0 comments on commit 6a3b0c1

Please sign in to comment.