Skip to main content

Dora Node for object detection with dora YOLOv8

Project description

Dora Node for detecting objects in images using YOLOv8

This node is used to detect objects in images using YOLOv8.

YAML

- id: object_detection
  build: pip install ../../node-hub/dora-yolo
  path: dora-yolo
  inputs:
    image: webcam/image

  outputs:
    - bbox
  env:
    MODEL: yolov5n.pt

Inputs

  • image: Arrow array containing the base image
## Image data
image_data: UInt8Array # Example: pa.array(img.ravel())
metadata = {
  "width": 640,
  "height": 480,
  "encoding": str, # bgr8, rgb8
}

## Example
node.send_output(
  image_data, {"width": 640, "height": 480, "encoding": "bgr8"}
  )

## Decoding
storage = event["value"]

metadata = event["metadata"]
encoding = metadata["encoding"]
width = metadata["width"]
height = metadata["height"]

if encoding == "bgr8":
    channels = 3
    storage_type = np.uint8

frame = (
    storage.to_numpy()
    .astype(storage_type)
    .reshape((height, width, channels))
)

Outputs

  • bbox: an arrow array containing the bounding boxes, confidence scores, and class names of the detected objects
bbox: {
    "bbox": np.array,  # flattened array of bounding boxes
    "conf": np.array,  # flat array of confidence scores
    "labels": np.array,  # flat array of class names
}

encoded_bbox = pa.array([bbox], {"format": "xyxy"})

decoded_bbox = {
    "bbox": encoded_bbox[0]["bbox"].values.to_numpy().reshape(-1, 4),
    "conf": encoded_bbox[0]["conf"].values.to_numpy(),
    "labels": encoded_bbox[0]["labels"].values.to_numpy(zero_copy_only=False),
}

Example

Check example at examples/python-dataflow

License

This project is licensed under Apache-2.0. Check out NOTICE.md for more information.

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

dora_yolo-0.3.7.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

dora_yolo-0.3.7-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file dora_yolo-0.3.7.tar.gz.

File metadata

  • Download URL: dora_yolo-0.3.7.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for dora_yolo-0.3.7.tar.gz
Algorithm Hash digest
SHA256 b3539140b0705f5e2d9a3c36a3e35d21f4f7a9adaeea8fb046f878a1272d146e
MD5 afed1bd50014e0e94c261788619ca6c0
BLAKE2b-256 66c2919c72eebe0786cf67cadca0ce49a8b4f3546d6fe8d37b64b4ce3d5266e3

See more details on using hashes here.

File details

Details for the file dora_yolo-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: dora_yolo-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for dora_yolo-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 923240f02ccf2fce346b09159735c9fd06423c92ed0df10fdee2e3c636ca7a91
MD5 d2828de912b394b51910c46ac27df4cc
BLAKE2b-256 dc070592af7ef6d356dcc0f6c668e020571f7dda801d9f58dfda6a7820cd3bd3

See more details on using hashes here.

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