Skip to main content

No project description provided

Project description

The power of Coral Edge TPU and Ultralytics all in one place: edge-tpu-silva.

Our edge-tpu-silva is a Python package that simplifies the installation of the Coral TPU USB dependency and ensures compatibility with PyCoral and Ultralytics. This package empowers object detection, segmentation and classification capabilities on various edge devices to achieve higher FPS (Real Time Processor Speed).

Hardware Requirement

Coral USB Accelerator Exclusivity:

The edge-tpu-silva library is purpose-built for seamless integration with the Coral USB Accelerator. This powerful hardware accelerator is not just a requirement but a strategic choice, unlocking the library's full potential for superior object detection, segmentation and classification.

Discover the Coral USB Accelerator and experience a tailored approach to edge computing with the edge-tpu-silva library.

Installation

Step 1: Install edge-tpu-silva

To install edge-tpu-silva, use the following pip command in a specified python environment:

pip install edge-tpu-silva

Step 2: Run Setup Command

System Compatibility

This table provides an overview of the compatibility of the system with different devices and operating systems.

Compatibility Setup Command
Raspberry Pi 5 silvatpu-linux-setup
Raspberry Pi 4 silvatpu-linux-setup
Raspberry Pi 3 silvatpu-linux-setup
Jetson Nano silvatpu-linux-setup
x86-64 silvatpu-linux-setup
Armv7 (32-bit) silvatpu-linux-setup
Armv8 (64-bit) silvatpu-linux-setup
Windows
macOS

In order to configure setup tools for your system, run the setup command in the terminal after step 1 is completed.

Example: If you are on a Raspberry Pi 5, run below command in the terminal following step 1.

silvatpu-linux-setup

Note: Please ensure that you have the Coral USB Accelerator connected through usb 3.0 port (for faster speed). If the Coral USB Accelerator was connected during the installation and setup, please disconnect and reconnect it to ensure proper configuration.

Usage

Object Detection Process

To perform object detection using the process_detection function, you can follow this example:

from edge_tpu_silva import process_detection

# Example Usage with Required Parameters
model_path = 'path/to/your/model.tflite'
input_path = 'path/to/your/input/video.mp4'
imgsz = 240

# Run the object detection process
outs = process_detection(model_path, input_path, imgsz)

for _, _ in outs:
  pass

Running process_detection in the Terminal: Using the Entry Point "silvatpu"

To perform object detection with the process_detection function from the command line, you can use the user-friendly entry point silvatpu. Here's an example command:

silvatpu -p det -m path/to/model.tflite -i path/to/input/video.mp4 -z 240 -t 0.5 -v True

Object Segmentation Process

To perform object segmentation using the process_segmentation function, you can follow this example:

from edge_tpu_silva import process_segmentation

# Example Usage with Required Parameters
model_path = 'path/to/your/model.tflite'
input_path = 'path/to/your/input/video.mp4'
imgsz = 192

# Run the object segmentation process
outs = process_segmentation(model_path, input_path, imgsz)

for _, _ in outs:
  pass

Running process_segmentation in the Terminal: Using the Entry Point "silvatpu"

To perform object segmentation with the process_segmentation function from the command line, you can use the user-friendly entry point silvatpu. Here's an example command:

silvatpu -p seg -m path/to/model.tflite -i path/to/input/video.mp4 -z 192 -t 0.5 -v True

Process detection, segmentation and classification Function Input Parameters

Parameter Description Default Value
model_path Path to the object segmentation model. -
input_path File path of image/video to process (Camera(0|1|2)). -
imgsz Defines the image size for inference. -
threshold Threshold for detected objects. 0.4
verbose Display prints to the terminal. True
show Display frame with segmentation. False
classes Filters predictions to a set of class IDs. None

Process detection, segmentation and classification Function Output

Each process function yields the following output:

Output Parameter Description
objs_lst List of objects detected in frame.
fps Frames per second (fps) of the processed video.

Example usage:

from edge_tpu_silva import process_detection

# Example Usage with Required Parameters
model_path = 'path/to/your/model.tflite'
input_path = 'path/to/your/input/video.mp4'
imgsz = 240

# Run the object detection process
outs = process_detection(model_path, input_path, imgsz)

for objs_lst, fps in outs:
    # Access the output parameters as needed
    print(f"Processed frame with {len(objs_lst)} objects. FPS: {fps}")
    print("List of object predictions in frame:")
    print(objs_lst)

Dependencies

Coral TPU USB drivers
PyCoral
Ultralytics

Contribution

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

Python Package Index Maintainer(s) (c) [2024] David Nyarko

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

edge_tpu_silva-1.0.4.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

edge_tpu_silva-1.0.4-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

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