Skip to main content

A devkit for working with recorded and annotated train ride data from Deutsche Bahn.

Project description

RailLabel

image image

A devkit for working with recorded and annotated train ride data from Deutsche Bahn.

You can install the latest released version directly from PyPI.

pip install raillabel

For the full documentation look at the Github pages.

Examples

The first step in using raillabel is downloading a desired dataset (like OSDaR23). You can then load any scene by running

import raillabel

scene = raillabel.load("path/to/annotation_file.json")

This returns a raillabel.Scene, which is the root class for the annotations.

You can then extract information about the scene from the file

# Iterate over all annotations
for frame in scene.frames.values():
    for annotation in frame.annotations.values():
        pass  # do something with the annotation here

If a file is too extensive for your use-case you can filter out certain parts of a scene like this

from raillabel.filter import (
    IncludeObjectTypeFilter,
    ExcludeAnnotationTypeFilter,
    StartTimeFilter, ExcludeFrameIdFilter,
    IncludeAttributesFilter
)

scene_with_only_trains = scene.filter([IncludeObjectTypeFilter(["rail_vehicle"])])

scene_without_bboxs = scene.filter([ExcludeAnnotationTypeFilter(["bbox"])])

cut_scene_with_only_red_trains = scene.filter([
    StartTimeFilter("1587349200.004200000"),
    ExcludeFrameIdFilter([2, 4]),
    IncludeObjectTypeFilter(["rail_vehicle"]),
    IncludeAttributesFilter({"color": "red"}),
])

An overview of all available filters can be found here.

If you then want to save your changes, then use

raillabel.save(cut_scene_with_only_red_trains, "/path/to/target.json")

If you want to get a more practical understanding of the library, check out the tutorial page.

Contributing

To set up a development environment, clone the project and install it into a virtual environment.

git clone https://github.com/DSD-DBS/raillabel
cd raillabel
python -m venv .venv

source .venv/bin/activate.sh  # for Linux / Mac
.venv\Scripts\activate  # for Windows

pip install -U pip pre-commit
pip install -e '.[docs,test]'
pre-commit install

We'd love to see your bug reports and improvement suggestions! Please take a look at our guidelines for contributors for details.

Licenses

This project is compliant with the REUSE Specification Version 3.0.

Copyright DB InfraGO AG, licensed under Apache 2.0 (see full text in LICENSES/Apache-2.0.txt)

Dot-files are licensed under CC0-1.0 (see full text in LICENSES/CC0-1.0.txt)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raillabel-4.2.0.tar.gz (43.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raillabel-4.2.0-py3-none-any.whl (66.4 kB view details)

Uploaded Python 3

File details

Details for the file raillabel-4.2.0.tar.gz.

File metadata

  • Download URL: raillabel-4.2.0.tar.gz
  • Upload date:
  • Size: 43.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for raillabel-4.2.0.tar.gz
Algorithm Hash digest
SHA256 51d13dcc905ac7a4a3f5887299f755cb94cb9d46ba31a97f170d7647a6f9093a
MD5 34a8c3d16da6adb539f7d4e70a394f27
BLAKE2b-256 d802cdee127a9c4f01c81f4e03f87f36b7b31e40034b7733fcf497bed41e1992

See more details on using hashes here.

File details

Details for the file raillabel-4.2.0-py3-none-any.whl.

File metadata

  • Download URL: raillabel-4.2.0-py3-none-any.whl
  • Upload date:
  • Size: 66.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for raillabel-4.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7438a4675bc113f672a7133d5f42ef8361ee9d2671deba1b8e3e2702e461a43
MD5 8f8030ed8fcd51f193676ee0a5432d87
BLAKE2b-256 3a51c9d5f548c6a0fd7b0ed4c86ba7ef394fa80f55b0c71f9640e191b448746c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page