Averian AI Validator SDK
Project description
Averian AI Validator SDK User Guide
Welcome to the Averian AI Validator Python SDK. This guide provides a comprehensive overview of how to integrate automated anomaly detection into your workflows.
1. Introduction
The SDK allows you to interact with the Averian AI Validator platform programmatically. You can manage projects, upload training data, trigger model retraining, and most importantly, run real-time inference to detect anomalies in images.
2. Setup
Installation
The SDK is available via pip:
pip install averian-ai-validator-sdk
Authentication
Authentication is handled via API Keys.
- API Keys are generated in the "Organization Settings" page of the web platform.
- Each API Key is bound to a specific Organization.
- The key carries specific permissions (Inference, Admin, etc.). Ensure your key has
Inferencepermissions for production use.
3. Core Concepts
Note on Configuration: While this SDK provides methods to create and configure projects, input sources, and processors, it is highly recommended to use the AI Validator webapp for initial setup. The webapp provides essential visual tools for defining regions of interest, masking, and processor sequencing that are difficult to replicate via code.
- Organization: Your top-level container. An API key gives you access to one organization.
- Project: A specific use-case or product line (e.g., "PCBA Inspection").
- Input Source: A specific camera, station, or data stream within a project.
- Model Ensemble: A trained AI model hosted on the platform. Each Input Source typically has a "Default Ensemble" used for inference.
4. Basic Workflow
Connecting
from averian_ai_validator_sdk import APIClient
api = APIClient()
# Note: api_host is the base URL of your instance (e.g., https://validator.yourcompany.com)
api.connect("https://validator_address", "YOUR_API_KEY")
Navigating Projects and Sources
To run inference, you need a project_id and an input_id.
# List all projects in your organization
projects = api.get_projects()['projects']
for p in projects:
print(f"Project: {p['name']} (ID: {p['id']})")
# List input sources for a specific project
project_id = "your-project-uuid"
sources = api.get_input_sources(project_id)
for s in sources:
print(f"Source: {s['name']} (ID: {s['id']})")
Running Inference
Inference requires an image (as a blob), the project ID, input ID, and a model ID.
project_id = "..."
input_id = "..."
image_path = "sample.jpg"
# 1. Get the model (using the default ensemble for the source)
source = api.get_input_source_by_id(project_id, input_id)
model_id = source.get('defaultEnsemble')
# 2. Prepare the image
img_blob = api.read_file_as_blob(image_path)
# 3. Run Inference
result = api.infer(
project_id=project_id,
input_id=input_id,
model_id=model_id,
img_name="sample",
img_ext="jpg",
img_blob=img_blob
)
print(f"Is Anomalous: {result['isAnomalous']}")
Retrieving Heatmaps
If an anomaly is detected, you can download a visual heatmap showing the localized area of concern.
heatmap_bytes = api.fetch_result_image_with_heatmap(project_id, result['id'])
with open("result_heatmap.jpg", "wb") as f:
f.write(heatmap_bytes)
5. Advanced Usage
Data Management
You can programmatically manage your training and testing datasets.
move_from_train_to_test(project_id, image_id)set_image_anomality(project_id, image_id, is_anomaly, coordinates): Re-label data from the SDK.
Retraining
Trigger a new training session for a specific input source:
from averian_ai_validator_sdk import ModelType
api.train_new_model(project_id, input_id, ModelType.PATCHCORE)
Step 6 — Clean Up (Optional)
api.del_result(project_id, result['id'])
For the full API reference, visit the Averian AI Validator documentation.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file averian_ai_validator_sdk-1.0.1214.tar.gz.
File metadata
- Download URL: averian_ai_validator_sdk-1.0.1214.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e315679e5d16a6bc97b87a9ce40d9f8761441f2fb04da13682b16fc37fe72e15
|
|
| MD5 |
dbd1324864341b08e7a175e7206ac305
|
|
| BLAKE2b-256 |
6b73e3b4419cec805ca9eceec816069d32fb647875bf492334bd33cd52970a41
|
File details
Details for the file averian_ai_validator_sdk-1.0.1214-py3-none-any.whl.
File metadata
- Download URL: averian_ai_validator_sdk-1.0.1214-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a7d1085d827d90a69dbd8421f5fd193af3bb9cba55bd6fa7cb9dc80c51c771f
|
|
| MD5 |
3c9ab0277de52384710f03442b3b3b5f
|
|
| BLAKE2b-256 |
715e419f3b193da5361f8372b318d4fa7ab1f12c579a7d917568848390481db0
|