Skip to main content

Abraia Python SDK

Project description

Build Status Python Package Package Downloads

Abraia Vision SDK

The Abraia Vision SDK helps developers create, customize, and deploy edge-ready vision applications. It unifies image processing, model training, and inference so you can transform visual data into production-ready solutions, including real-time video analysis and object tracking.

Install the Abraia SDK and CLI on Windows, Mac, or Linux:

python -m pip install -U abraia

With Abraia DeepLab, you can annotate images, train custom classification, detection, and segmentation models, and export them for use in this Python SDK.

People monitoring

Abraia SDK provides a set of tools to monitor people flow and waiting time in public spaces or commercial areas. You can easily implement queue monitoring or flow counting applications using the specialized tools available in the abraia.inference.tools module.

from abraia.inference import Model, Tracker
from abraia.inference.tools import LineCounter, RegionTimer
from abraia.utils import Video, render_results, render_counter, render_region

model = Model("multiple/models/yolov8n.onnx")
video = Video('people-walking.mp4')
tracker = Tracker(frame_rate=video.frame_rate)
line_counter = LineCounter([(0, 650), (1920, 650)])
region_timer = RegionTimer([(10, 600), (1690, 600), (1690, 700), (10, 700)])

for k, frame in enumerate(video):
    results = model.run(frame, labels=['person'])
    results = tracker.update(results)
    in_count, out_count = line_counter.update(results)
    in_objects, out_objects = region_timer.update(results, k / video.frame_rate)
    frame = render_counter(frame, line_counter.line, f"In: {in_count} | Out: {out_count}")
    frame = render_region(frame, region_timer.region, f"Count: {len(in_objects)}")
    frame = render_results(frame, in_objects)
    video.show(frame)

people detected

Face recognition

Identify people on images with face recognition as shown bellow.

import os

from abraia.inference import FaceRecognizer
from abraia.utils import load_image, save_image, render_results

img = load_image('images/rolling-stones.jpg')
out = img.copy()

recognition = FaceRecognizer()

index = []
for src in ['mick-jagger.jpg', 'keith-richards.jpg', 'ronnie-wood.jpg', 'charlie-watts.jpg']:
    img = load_image(f"images/{src}")
    rslt = recognition.identify_faces(img)[0]
    index.append({'name': os.path.splitext(src)[0], 'vector': rslt['vector']})

results = recognition.identify_faces(results, index)
render_results(out, results)
save_image(out, 'images/rolling-stones-identified.jpg')

rolling stones identified

License plates recognition

Automatically recognize car license plates in images and video streams.

from abraia.inference import PlateRecognizer
from abraia.utils import load_image, show_image, render_results

alpr = PlateRecognizer()

img = load_image('images/car.jpg')
results = alpr.recognize(img)
frame = render_results(img, results)
show_image(img)

car license plate recognition

Semantic search

Search on images with embeddings.

from tqdm import tqdm
from glob import glob
from abraia.utils import load_image
from abraia.inference.clip import Clip
from abraia.inference.ops import search_vector

clip_model = Clip()

image_paths = glob('images/*.jpg')
image_index = [{'vector': clip_model.get_image_embeddings([load_image(image_path)])[0]} for image_path in tqdm(image_paths)]

text_query = "full body person"
vector = clip_model.get_text_embeddings([text_query])[0]

idxs, scores = search_vector(vector, image_index)
print(f"Similarity score is {scores[0]} for image {image_paths[idxs[0]]}")

Hyperspectral imaging

The abraia.multiple module simplifies working with multispectral and hyperspectral images, offering HSI analysis and classification workflows.

Hyperspectral data contains many spectral bands, so it cannot be shown directly as a standard RGB image. Instead, extract a few bands and plot them as grayscale images, or apply PCA to generate a 3-channel pseudo-RGB image from the first three principal components.

Use the available Colab notebook to start experimenting with the multispectral tools:

classification

Hyperspectral image analysis and classification

License

This software is licensed under the MIT License. View the license.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abraia-0.25.14.tar.gz (65.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abraia-0.25.14-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file abraia-0.25.14.tar.gz.

File metadata

  • Download URL: abraia-0.25.14.tar.gz
  • Upload date:
  • Size: 65.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for abraia-0.25.14.tar.gz
Algorithm Hash digest
SHA256 d5ee42652191487fcf578c635938f31ea99bbe5af61a082847b1cde05d4d498a
MD5 8d54e563a250734ca26982ce34d2f9b4
BLAKE2b-256 ccc0f6120396c9ac24d2de03d8e5b06b0fa26885f4c40cc893c66f1f6e7c80ac

See more details on using hashes here.

File details

Details for the file abraia-0.25.14-py3-none-any.whl.

File metadata

  • Download URL: abraia-0.25.14-py3-none-any.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for abraia-0.25.14-py3-none-any.whl
Algorithm Hash digest
SHA256 75065be670ca6565476baf0816c57d83874cf1d1d70a3227f0f44ff78e03ef9e
MD5 3b48adf596b812d8099641def7626b01
BLAKE2b-256 3322e7fa295a0e106041ba7daf4b69d7eaf4035bf72337326f5ba8230d74e227

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