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")

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.1.1.tar.gz (71.1 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.1.1-py3-none-any.whl (109.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for raillabel-4.1.1.tar.gz
Algorithm Hash digest
SHA256 467af9f4345daf71e4d7cdbd20e3355f2ab16c1fc062ab71500a53f915be6e9f
MD5 46343a71b19d59961b5f7ab594485280
BLAKE2b-256 c851015cb01680c984f3b9ceabd560eea0617f13b988dc1d2af91ed6139bdb33

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for raillabel-4.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c5c028855e8f8f33c86df96aacfde0151a58c591c35e15171b95b30ca24e205
MD5 37c4cdbf44cc81a3bb1975e0996dec0f
BLAKE2b-256 333af5f32ce3b5f2c16aa4347d3dda6444362c635d05442c967b7c5112ff7537

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