- How to apply a simple image classification model using sample medical images.
- How to log directly to the Obz AI cloud platform from your code.
obz
package if you haven’t already installed it. Also let’s install gdown
to download pretrained weights and medmnist
to download examples of lung nodules.
ObzClient
from our Python library, you will need your unique API key. This key is required to securely connect your code to your account on our SaaS platform.
Here’s how to find your API key:
-
Log in to your Dashboard:
Open your web browser and go to Obz.AI. Log in using your registered email and password. -
Navigate to the Settings section:
After logging in, look for a menu item called “Settings”. Click on it to access your API settings. Make sure to copy this key now — you will need it in the next steps.
Configure the ViT classifer based on DINO backbone
We are adding a binary classification head (see howtorch.nn.Linear
) onto a DINO backbone.

Using ObzClient to Explain and Monitor a AI Model
In this section, we’ll show you how to set up and use theObzClient
to automatically log your data features and model explanation outputs to the Obz AI cloud platform.
Local Usage
You can use the Data Inspector Module and XAI Module locally on your machine. To explore all the core features of these modules, please see the Jupyter notebook tutorials provided:Cloud Logging with ObzClient
To take full advantage of Obz AI, you can log your data features and model explanation outputs to the Obz AI cloud. This enables you to:- Track and organize input features and outlier statistics.
- Store and visualize model explanations and results.
- Collaborate and share insights via the Obz dashboard.
Step 1: Instantiate the Modules
Instantiate and fit an Outlier Detector from theData Inspector
Module for outlier detection:
XAI Tool
Module:
Step 2: Prepare ObzClient
for a cloud logging
Now, when you have your fitted OutlierDetector
instance and XAITool
instances, you are ready to wrap it into your ObzClient
!It will take care of logging data to your cloud dashboard.
Step 3: Authenticate ObzClient
To use our library and send logs from your project to your online dashboard, you first need to authenticate your client. Authentication links your logs to your specific account and project, ensuring that you can securely access and manage your data.
To authenticate, you will need an API key. This key is a unique identifier for your account and allows the library to send information to your dashboard. You can find your API key by logging into your account and visiting your dashboard. If you haven’t registered yet, please create an account and follow the instructions to generate your API key.
Once you have the API key, pass it to the client’s .login()
method in your Python code.
.netrc
file on your computer. This means you do not have to enter your API key again when using the ObzClient
, authentication will happen automatically in future sessions.
Now let’s initialize a project with .init_project()
method. This method accepts following arguments:
-
project_name
(str, required): the name of the project you want to work with.- If the project already exists, you will be connected to it.
- If it is a new name, a new project will be created automatically.
-
ml_task
(str, required): the type of machine learning task you are working on. We will usebinary_classification
in this tutorial.- This setting allows ObzClient to tailor the project’s dashboard and logging features to your specific task.
-
index2name
(dict, optional): A dictionary mapping numeric class indices ({0: "benign", 1: "malignant"}
in this tutorial) to human-readable class names.- Providing this helps ObzClient visualize your results with actual class names, making your dashboard easier to understand.
Step 4: Log data features and model explanations to the Obz AI cloud platform
Now you can log your reference data. Simply call.log_reference()
method on your client object. It will automatically send all reference data from your Outlier Detector into your Dashboard.
ObzClient
initiated with an outlier detector and an XAI tool, we are ready to .run_and_log
, processing batches of samples in the inference data.