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)
    results = [result for result in results if result['label'] == '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.detect(img)
results = alpr.recognize(img, results)
results = [result for result in results if len(result['lines'])]
for result in results:
    result['label'] = '\n'.join([line.get('text', '') for line in result['lines']])
    del result['score']
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.13.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.13-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: abraia-0.25.13.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.13.tar.gz
Algorithm Hash digest
SHA256 5433ee2d2550c08c7ea4f16cfb3a32ebd506ffcbc0926c23a7e3ca69f94cc51e
MD5 e1363e6a2a91190ceb5db7f7a86d2299
BLAKE2b-256 4dbbe4160549c71419c66da0b56f6aa118c51db60aaf5e851b94189cd124f408

See more details on using hashes here.

File details

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

File metadata

  • Download URL: abraia-0.25.13-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.13-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb20dc68be487e0283fcc82028b7ed4e09cb37aa8e5b11ff723543cb8974602
MD5 616cf1e58b93186cb009fd34b6dac9ab
BLAKE2b-256 edc0252e5b0c3ac39fd6a49d2a701179e49aa1c1b87ffc8f0a360fe945126741

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