Skip to content

Commit d392f25

Browse files
authored
Update to version 1.1.0 (#8)
* Add changelog * Update feature request template * Fix MD032 violation * Enable double quote conversion * Update setup.py * Add python language version to black hook - Update YAML format * Remove imports to force explicit imports * Add line length limit to black hook * Update to f strings and fix format issues * Update to double quotes * Add docstring * Update README.md * Update README.md * Fix doc formatting * Set alpha default value according to KITTI devkit * Add range check for truncation and occlusion * Sort imports in black style * Fix missing alpha return * Resolve #2 * Update import * Fix package structure (#5) * Flatten project layout * Add example tracklet labels XML and corresponding unit tests * Update installation instructions in README to use install from PyPI * Improve XML parsing and error handling * Fix type hint for tracklet_element * Fix type hint for tracklet_element in TrackletParser * Provide detailed usage instructions and examples * Improve frame list loading and label writing logic * Enhance docstrings for TrackletParser methods with clearer descriptions * Fix argument description in convert_tracklets_to_kitti method docstring * Add return type annotation * Remove unnecessary blank lines and comments in TrackletParser * Add example frame list for testing resources * Enhance docstrings and logging in TrackletParser * Add unit tests for TrackletParser methods * Update version to 1.1.0
1 parent 8b75503 commit d392f25

File tree

15 files changed

+698
-198
lines changed

15 files changed

+698
-198
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A clear and concise description of what the bug is.
1212

1313
**To Reproduce**
1414
Steps to reproduce the behavior:
15+
1516
1. Go to '...'
1617
2. Click on '....'
1718
3. Scroll down to '....'

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@ assignees: ''
77

88
---
99

10-
**Is your feature request related to a problem? Please describe.**
11-
A clear and concise description of what the problem is.
10+
**Describe the feature**
11+
A clear and concise description of what the feature should do.
1212

13-
**Describe the solution you'd like**
14-
A clear and concise description of what you want to happen.
15-
16-
**Describe alternatives you've considered**
17-
A clear and concise description of any alternative solutions or features you've considered.
13+
**Motivation**
14+
A clear and concise description of the motivation of the feature.
1815

1916
**Additional context**
2017
Add any other context or screenshots about the feature request here.

.pre-commit-config.yaml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,53 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 22.6.0
3+
rev: 25.1.0
44
hooks:
55
- id: black
6-
args: [ '--skip-string-normalization' ]
6+
language_version: python3.12
7+
args:
8+
- "--line-length"
9+
- "79"
10+
- "--preview"
711
- repo: https://github.com/PyCQA/isort
8-
rev: 5.10.1
12+
rev: 6.0.1
913
hooks:
1014
- id: isort
15+
args:
16+
- "--multi-line"
17+
- "3"
18+
- "--trailing-comma"
19+
- "--force-grid-wrap"
20+
- "0"
21+
- "--use-parentheses"
22+
- "--ensure-newline-before-comments"
23+
- "--line-length"
24+
- "79"
1125
- repo: https://github.com/codespell-project/codespell
12-
rev: v2.1.0
26+
rev: v2.4.1
1327
hooks:
1428
- id: codespell
15-
- repo: https://github.com/myint/docformatter
16-
rev: v1.4
29+
# TODO: Remove this when docformatter is fixed
30+
#- repo: https://github.com/myint/docformatter
31+
# rev: v1.7.5
32+
- repo: local
1733
hooks:
1834
- id: docformatter
19-
args: [ "--in-place", "--wrap-descriptions", "79" ]
35+
name: docformatter
36+
entry: python -Im docformatter
37+
additional_dependencies:
38+
- docformatter == 1.7.5
39+
args:
40+
- "--in-place"
41+
- "--wrap-descriptions"
42+
- "79"
43+
language: python
2044
- repo: https://github.com/pre-commit/pre-commit-hooks
21-
rev: v4.3.0
45+
rev: v5.0.0
2246
hooks:
47+
- id: check-merge-conflict
48+
- id: check-yaml
2349
- id: trailing-whitespace
2450
- id: end-of-file-fixer
25-
- id: double-quote-string-fixer
26-
- id: check-merge-conflict
2751
- id: fix-encoding-pragma
28-
args: [ "--remove" ]
52+
args:
53+
- "--remove"

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [1.1.0] - 2025-04-19
6+
7+
### Added
8+
9+
- Published the package on [PyPI](https://pypi.org/project/tracklet-parser/), making it available for installation via `pip`.
10+
- Enhanced unit tests for `TrackletParser`:
11+
- Added tests for edge cases, such as empty XML files and invalid XML structures.
12+
- Added tests for missing frame lists and empty tracklet lists.
13+
- Integrated `TemporaryDirectory` for test isolation and automatic cleanup.
14+
15+
### Changed
16+
17+
- Improved test structure for better readability and maintainability:
18+
- Extracted helper methods for creating temporary files.
19+
- Simplified test setup and teardown using `TemporaryDirectory`.
20+
- Restructured the project to a flat layout for better organization.
21+
- Updated the `.pre-commit-config.yaml`:
22+
- Bumped all hooks to their new versions
23+
- Replaced `docformatter` configuration as it is currently broken
24+
- Updated `README.md`:
25+
- Improved the usage example with better comments and structure.
26+
- Added a "Testing" section to explain how to run tests.
27+
- Added a "Contributing" section with clear contribution guidelines.
28+
- Changed required Python version to `3.12`
29+
30+
---
31+
32+
## [1.0.1] - 2024-01-14
33+
34+
### Added
35+
36+
- Introduced `pyproject.toml` as the build system configuration file.
37+
38+
### Changed
39+
40+
- Migrated the project structure to a `src` layout for better modularity.
41+
- Updated pre-commit hook versions to ensure compatibility with the latest tools.
42+
- Revised installation instructions in `README.md` for clarity.
43+
44+
### Removed
45+
46+
- Deprecated `setup.py` in favor of `pyproject.toml` as per [PEP 517](https://peps.python.org/pep-0517/).
47+
48+
---
49+
50+
## [1.0.0] - 2022-08-14
51+
52+
### Added
53+
54+
- Initial version.
File renamed without changes.

README.md

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,67 @@
11
# Tracklet Parser
2+
3+
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/holtvogt/tracklet_parser/blob/develop/LICENSE.txt)
4+
[![python](https://img.shields.io/badge/python-3.12-blue)](https://www.python.org/downloads/)
5+
[![black](https://img.shields.io/badge/style-black-black)](https://github.com/psf/black)
6+
27
A parser for tracklet labels in KITTI Raw Format 1.0 created by the [Computer Vision Annotation Tool (CVAT)](https://github.com/openvinotoolkit/cvat).
38

4-
[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/holtvogt/tracklet_parser/blob/master/LICENSE)
5-
[![Python](https://img.shields.io/badge/python-3.9-blue)](https://www.python.org/downloads/)
9+
## Table of Contents
10+
11+
- [Tracklet Parser](#tracklet-parser)
12+
- [Table of Contents](#table-of-contents)
13+
- [Installation](#installation)
14+
- [Usage](#usage)
15+
- [Testing](#testing)
16+
- [Contributing](#contributing)
617

718
## Installation
8-
Assuming that you already have a working Python environment, you can install all necessary packages with
19+
20+
Install the package directly using `pip` from [PyPI](https://pypi.org/):
921

1022
```bash
11-
python setup.py install
23+
pip install tracklet-parser
1224
```
1325

1426
## Usage
15-
Creating a folder with text files in KITTI format. Each text file contains the labeling information of its corresponding recording.
27+
28+
To use the `tracklet-parser`, you need a `tracklet_labels.xml` file and, optionally, a `frame_list.txt` file that maps frame indices to point cloud file names. The parser generates one KITTI format label file per frame, storing them in the specified output directory.
29+
30+
Creating KITTI format label files from tracklet data is straightforward with the `tracklet-parser`. Each output file corresponds to a single frame and contains labeling information for all detected objects in that frame (e.g., `Car`, `Pedestrian`, etc.).
31+
32+
Here is an example script demonstrating how to parse a `tracklet_labels.xml` file and convert the tracklet data into KITTI format label files:
1633

1734
```python
18-
from tracklet_parser import TrackletParser
35+
from tracklet_parser.tracklet import Tracklet
36+
from tracklet_parser.tracklet_parser import TrackletParser
1937

2038
def main():
21-
tracklet_labels = "C:\\Foo\\tracklet_labels.xml"
22-
frame_list = "C:\\Foo\\frame_list.txt"
23-
output_dir = "C:\\Foo\\Bar"
24-
25-
tracklets = TrackletParser.parse_tracklet_xml(tracklet_labels)
26-
# Create n label text files in C:\Foo\Bar for n recordings
39+
tracklet_labels: str = "path/to/tracklet_labels.xml"
40+
frame_list: str = "path/to/frame_list.txt"
41+
output_dir: str = "path/to/output_dir"
42+
43+
tracklets: List[Tracklet] = TrackletParser.parse_tracklet_xml(tracklet_labels)
44+
# Create n label text files in path/to/output_dir for n (labeled) recordings in KITTI format
2745
TrackletParser.convert_tracklets_to_kitti(tracklets, frame_list, output_dir)
2846

2947
if __name__ == "__main__":
3048
main()
3149
```
50+
51+
## Testing
52+
53+
To run the tests, use the following command:
54+
55+
```bash
56+
python -m unittest discover tests
57+
```
58+
59+
## Contributing
60+
61+
Contributions are welcome! To contribute:
62+
63+
1. Fork the repository.
64+
2. Create a new branch for your feature or bugfix.
65+
3. Submit a pull request with a clear description of your changes.
66+
67+
Please ensure your code adheres to the [Black](https://github.com/psf/black) coding style.

pyproject.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "tracklet_parser"
7+
version = "1.1.0"
8+
dependencies = [
9+
"black",
10+
"codespell",
11+
"docformatter",
12+
"isort",
13+
"numpy",
14+
"pandas",
15+
"pre-commit",
16+
"pylint",
17+
"wheel",
18+
]
19+
requires-python = ">=3.12"
20+
maintainers = [
21+
{ name = "Bjoern Holtvogt", email = "bjoern.holtvogt@gmail.com" },
22+
]
23+
description = "A parser for tracklet labels in KITTI Raw Format 1.0 created by the Computer Vision Annotation Tool (CVAT)."
24+
readme = { file = "README.md", content-type = "text/markdown" }
25+
license = { file = "LICENSE.txt" }
26+
keywords = ["tracklet", "cvat", "kitti", "annotation"]
27+
classifiers = [
28+
"Development Status :: 4 - Beta",
29+
"Intended Audience :: Developers",
30+
"Topic :: Software Development",
31+
"License :: OSI Approved :: MIT License",
32+
"Programming Language :: Python :: 3.10",
33+
]
34+
35+
[project.urls]
36+
repository = "https://github.com/holtvogt/tracklet_parser"
37+
issues = "https://github.com/holtvogt/tracklet_parser/issues"
38+
changelog = "https://github.com/holtvogt/tracklet_parser/blob/develop/CHANGELOG.md"
39+
40+
[tool.setuptools]
41+
packages = ["tracklet_parser"]

setup.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

tests/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
42 point_cloud_042
2+
100 point_cloud_100
3+
200 point_cloud_200

0 commit comments

Comments
 (0)