Name | segments-runner JSON |
Version |
0.1.9
JSON |
| download |
home_page | None |
Summary | Run multiple segments of EdgeTPU models in sequence |
upload_time | 2025-02-18 10:13:26 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <3.10,>=3.7 |
license | MIT License
Copyright (c) 2025 Changhun Han
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
|
keywords |
edgetpu
segments
runner
|
VCS |
 |
bugtrack_url |
|
requirements |
numpy
None
None
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# SegmentsRunner
**SegmentsRunner** is a Python module that sequentially executes one or more Edge TPU models split into multiple segments. It supports both classification and detection workflows.
## Installation
### Install Dependency
1. **install tflite-runtime**
- Example below (Python 3.9, x86_64 Linux):
```sh
python3 -m pip install \
https://github.com/google-coral/pycoral/releases/download/v2.0.0/\
tflite_runtime-2.5.0.post1-cp39-cp39-linux_x86_64.whl
```
2. **install PyCoral**
- Example below (Python 3.9, x86_64 Linux):
```sh
python3 -m pip install \
https://github.com/google-coral/pycoral/releases/download/v2.0.0/\
pycoral-2.0.0-cp39-cp39-linux_x86_64.whl#sha256=77c81c64a99119019c0d65ae9b1af25d2856ab6057dac27d3ea64dac963bef16
```
### Instal Package (Pip)
```sh
pip install segments-runner
```
### Install Package (Source)
1. **Clone the Repository**
```shell
git clone https://github.com/HanChangHun/SegmentsRunner.git
cd SegmentsRunner
```
2. **Install the Package**
Since the project uses a `pyproject.toml` file, you can install it locally with:
```shell
pip install .
```
### Install Using `uv`
If you prefer using `uv` for dependency management, you can install the package as follows:
1. **Install Dependencies**
```sh
uv pip install -r requirements.txt
```
2. **Install SegmentsRunner**
```sh
uv pip install .
```
## Usage Examples
### Classification Example
Below is a quick example of running two classification model segments on a single image:
```python
from pathlib import Path
from segments_runner import SegmentsRunner
# Paths to two classification model segments and a label file
model_paths = [
Path("model_segment1.tflite"),
Path("model_segment2.tflite")
]
labels_path = "labels.txt"
# Initialize the runner
runner = SegmentsRunner(
model_paths=model_paths,
labels_path=labels_path,
input_file="test_image.jpg"
)
# Invoke all segments
runner.invoke_all(task="classification")
# Retrieve classification results
results = runner.get_result(top_n=3) # Top 3 classes
print("Classification Results:", results)
```
### Detection Example
For object detection, simply specify `task="detection"` when invoking and call `get_result(detection=True)`:
```python
from pathlib import Path
from segments_runner import SegmentsRunner
# Paths to two detection model segments and a COCO label file
model_paths = [
Path("detection_segment1.tflite"),
Path("detection_segment2.tflite")
]
labels_path = "coco_labels.txt"
# Initialize the runner
runner = SegmentsRunner(
model_paths=model_paths,
labels_path=labels_path,
input_file="sample_image.jpg"
)
# Invoke all segments for detection
runner.invoke_all(task="detection")
# Retrieve detection results with a threshold
detection_results = runner.get_result(
detection=True,
score_threshold=0.5
)
# Print detected objects
for obj in detection_results:
label_name = runner.labels.get(obj.id, obj.id)
print(f"Detected {label_name} with score {obj.score:.2f} at {obj.bbox}")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "segments-runner",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.10,>=3.7",
"maintainer_email": null,
"keywords": "EdgeTPU, segments, runner",
"author": null,
"author_email": "Changhun Han <ehwjs1914@naver.com>",
"download_url": "https://files.pythonhosted.org/packages/47/67/1c147fc842c6a6f73235a0eac80f09f34554d2da1f1ed5439ee83ac66fc2/segments_runner-0.1.9.tar.gz",
"platform": null,
"description": "# SegmentsRunner\n\n**SegmentsRunner** is a Python module that sequentially executes one or more Edge TPU models split into multiple segments. It supports both classification and detection workflows.\n\n## Installation\n\n### Install Dependency\n\n1. **install tflite-runtime**\n - Example below (Python 3.9, x86_64 Linux):\n\n ```sh\n python3 -m pip install \\\n https://github.com/google-coral/pycoral/releases/download/v2.0.0/\\\n tflite_runtime-2.5.0.post1-cp39-cp39-linux_x86_64.whl\n ```\n\n2. **install PyCoral**\n\n - Example below (Python 3.9, x86_64 Linux):\n\n ```sh\n python3 -m pip install \\\n https://github.com/google-coral/pycoral/releases/download/v2.0.0/\\\n pycoral-2.0.0-cp39-cp39-linux_x86_64.whl#sha256=77c81c64a99119019c0d65ae9b1af25d2856ab6057dac27d3ea64dac963bef16\n ```\n\n### Instal Package (Pip)\n\n```sh\npip install segments-runner\n```\n\n### Install Package (Source)\n\n1. **Clone the Repository** \n\n ```shell\n git clone https://github.com/HanChangHun/SegmentsRunner.git\n cd SegmentsRunner\n ```\n\n2. **Install the Package** \n Since the project uses a `pyproject.toml` file, you can install it locally with:\n\n ```shell\n pip install .\n ```\n\n### Install Using `uv`\n\nIf you prefer using `uv` for dependency management, you can install the package as follows:\n\n1. **Install Dependencies**\n\n ```sh\n uv pip install -r requirements.txt\n ```\n\n2. **Install SegmentsRunner**\n\n ```sh\n uv pip install .\n ```\n\n## Usage Examples\n\n### Classification Example\n\nBelow is a quick example of running two classification model segments on a single image:\n\n```python\nfrom pathlib import Path\nfrom segments_runner import SegmentsRunner\n\n# Paths to two classification model segments and a label file\nmodel_paths = [\n Path(\"model_segment1.tflite\"),\n Path(\"model_segment2.tflite\")\n]\nlabels_path = \"labels.txt\"\n\n# Initialize the runner\nrunner = SegmentsRunner(\n model_paths=model_paths,\n labels_path=labels_path,\n input_file=\"test_image.jpg\"\n)\n\n# Invoke all segments\nrunner.invoke_all(task=\"classification\")\n\n# Retrieve classification results\nresults = runner.get_result(top_n=3) # Top 3 classes\nprint(\"Classification Results:\", results)\n```\n\n### Detection Example\n\nFor object detection, simply specify `task=\"detection\"` when invoking and call `get_result(detection=True)`:\n\n```python\nfrom pathlib import Path\nfrom segments_runner import SegmentsRunner\n\n# Paths to two detection model segments and a COCO label file\nmodel_paths = [\n Path(\"detection_segment1.tflite\"),\n Path(\"detection_segment2.tflite\")\n]\nlabels_path = \"coco_labels.txt\"\n\n# Initialize the runner\nrunner = SegmentsRunner(\n model_paths=model_paths,\n labels_path=labels_path,\n input_file=\"sample_image.jpg\"\n)\n\n# Invoke all segments for detection\nrunner.invoke_all(task=\"detection\")\n\n# Retrieve detection results with a threshold\ndetection_results = runner.get_result(\n detection=True,\n score_threshold=0.5\n)\n\n# Print detected objects\nfor obj in detection_results:\n label_name = runner.labels.get(obj.id, obj.id)\n print(f\"Detected {label_name} with score {obj.score:.2f} at {obj.bbox}\")\n```\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 Changhun Han\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell \n copies of the Software, and to permit persons to whom the Software is \n furnished to do so, subject to the following conditions: \n \n The above copyright notice and this permission notice shall be included in \n all copies or substantial portions of the Software. \n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING \n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \n DEALINGS IN THE SOFTWARE.\n ",
"summary": "Run multiple segments of EdgeTPU models in sequence",
"version": "0.1.9",
"project_urls": {
"Homepage": "https://github.com/HanChangHun/SegmentsRunner",
"Issues": "https://github.com/HanChangHun/SegmentsRunner/issues",
"Repository": "https://github.com/HanChangHun/SegmentsRunner"
},
"split_keywords": [
"edgetpu",
" segments",
" runner"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "269dfc45b6cc9253e4c977a8d71e0661d987107b30d7bf567831551ed183bfc6",
"md5": "1d6ec7c7a2234f77f3288ad3a94d5a1c",
"sha256": "ed01bdee19945f43abe05f5c7c9dd44466d2af56abdf9e5fdc77c036ca60200d"
},
"downloads": -1,
"filename": "segments_runner-0.1.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1d6ec7c7a2234f77f3288ad3a94d5a1c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.10,>=3.7",
"size": 1370330,
"upload_time": "2025-02-18T10:13:23",
"upload_time_iso_8601": "2025-02-18T10:13:23.465639Z",
"url": "https://files.pythonhosted.org/packages/26/9d/fc45b6cc9253e4c977a8d71e0661d987107b30d7bf567831551ed183bfc6/segments_runner-0.1.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "47671c147fc842c6a6f73235a0eac80f09f34554d2da1f1ed5439ee83ac66fc2",
"md5": "25feaa06dddd077164976c8f6509ed5f",
"sha256": "5b176ed9354f692d62d585957961771362e7844ebc7a6bed7ccd5f8a2572afe2"
},
"downloads": -1,
"filename": "segments_runner-0.1.9.tar.gz",
"has_sig": false,
"md5_digest": "25feaa06dddd077164976c8f6509ed5f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.10,>=3.7",
"size": 1374379,
"upload_time": "2025-02-18T10:13:26",
"upload_time_iso_8601": "2025-02-18T10:13:26.871946Z",
"url": "https://files.pythonhosted.org/packages/47/67/1c147fc842c6a6f73235a0eac80f09f34554d2da1f1ed5439ee83ac66fc2/segments_runner-0.1.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-18 10:13:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HanChangHun",
"github_project": "SegmentsRunner",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "numpy",
"specs": [
[
"==",
"1.26.4"
]
]
},
{
"name": null,
"specs": []
},
{
"name": null,
"specs": []
}
],
"lcname": "segments-runner"
}