SDK
The fusion_sdk Python package is a client for interacting with Clarity programmatically. It can upload imagery, manage labels, download datasets and model artifacts, and read inference results from scripts and notebooks.
The SDK is provisioned to specific customers and is not part of the standard platform package. Contact the Metaspectral team to request the wheel and a service token.
Install the SDK
The SDK is distributed as a Python wheel named fusion_sdk-<version>-py3-none-any.whl. Install it in a Python 3.10 or newer virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install /path/to/fusion_sdk-<version>-py3-none-any.whl
On Windows, activate the environment with .venv\Scripts\activate.
Create a client
Set a service token in your environment, then create the production client:
import os
from fusion_sdk.implementations_v2.common.enums import SDKEnvironmentEnum
from fusion_sdk.implementations_v2.FusionSDKV2 import FusionSDKV2
sdk = FusionSDKV2(
service_token=os.environ["CLARITY_SERVICE_TOKEN"],
environment=SDKEnvironmentEnum.PROD,
)
FusionSDKV2 requires service_token and accepts optional environment and api_url arguments. Do not embed a service token in source control.
The client exposes five modules. Their get methods return resource objects with data fields and resource-specific actions.
Modules
- Images: upload HSI files, inspect image metadata, attach labels, and download imagery.
- Folders: traverse folders and download imagery beneath a folder.
- Dataset versions: download ML datasets, labels, and train/validation/test splits.
- Model versions: retrieve model versions, inspect inference results, and download model artifacts.
- Class collections: create and inspect class collections and classes.