Validating Your Model with AI Stress Testing

This tutorial will guide you through validating CV models with RIME AI Stress Testing.

All examples are available in the rime_trial/ bundle provided during installation.

Please ensure that the extra RIME CV dependencies have been installed from the cv_requirements.txt file from installation. If you run into a ModuleNotFoundError at any point during this walkthrough, it is likely that you need to install the RIME CV Extras!

pip install -r cv_requirements.txt

Running Stress Testing on an Image Classification Example

This example uses an image classification model trained on a slightly modified version of the Animals with Attributes 2 dataset.

To kick off a run of AI Stress Testing:

rime-engine run-images --config-path images_examples/classification/awa2/stress_test_config.json

After this finishes running, you should be able to see the results in the web client, where they will be uploaded to the Default Project.

If you explore the test config in images_examples/classification/awa2/stress_tests_config.json you’ll see that we’ve configured a few parameters to specify the data, model, and other task-specific information:

{
    "run_name": "Image Classification",
    "data_info": { ... },
    "data_profiling_info": {
        "class_names": ["antelope", "grizzly+bear", ...,  "cow", "dolphin"]
    },
    "model_info": {
        "path": "images_examples/classification/awa2/awa2_cpu.py"
    },
    "model_task": "Image Classification"
}

For a full reference on the configuration file see the CV Configuration Reference.

For additional command line options, please see the CLI Reference.

Running Stress Testing on an Object Detection Example

This example uses an object model trained on a slightly modified version of the Pascal VOC dataset.

To kick off a run of AI Stress Testing:

rime-engine run-images --config-path images_examples/detection/voc/stress_test_config.json

After this finishes running, you should be able to see the results in the web client, where they will be uploaded to the Default Project.

If you explore the test config in images_examples/detection/voc/stress_test_config.json you’ll see that we’ve configured a few parameters to specify the data, model, and other task-specific information.

{
    "run_name": "Object Detection",
    "data_info": { ... },
    "data_profiling_info": {
        "class_names": ["aeroplane", "bicycle", ...,  "train", "tvmonitor"]
    },
    "model_info": {
        "path": "images_examples/detection/voc/model.py"
    },
    "model_task": "Object Detection"
}

For a full reference on the configuration file see the CV Configuration Reference.

For additional command line options, please see the CLI Reference.


Running Stress Testing on Your Own Model and Datasets

Define a Python Model File

Please refer to How to Create a CV Model FIle for step-by-step instructions on creating a model interface for RIME.

Gather Datasets

1. Prepare Input Data

For CV data, RIME uses .json (or .jsonl) files containing metadata for each image. For a detailed specification of data formatting, see Input Data Format.

Create Configuration

With your data and model ready, you can now create a configuration file. Examples of these can be found in the rime_trial/ bundle (the ones used for these examples are under images_examples/).

For a detailed reference on what the configuration should look like, see AI Stress Testing Configuration Reference.

Conclusion

Congratulations! You’ve successfully used RIME to test out the various CV models.

Once again, we strongly recommended that you run RIME using precomputed predictions. This will greatly improve both the RIME runtime and the test suite result quality.

Model inference tends to be the most computationally expensive part of each RIME run. While access to the model is still required for some tests due to design constraints (e.g., the use of randomness, iterative attacks, etc.), providing predictions in advance can help RIME avoid redundant computation so each run is fast and focused.

Troubleshooting

If you run into issues, please refer to our Troubleshooting page for help! Additionally, your RI representative will be happy to assist — feel free to reach out!