Skip to content

About

An offline-first computer vision integrity and security assurance platform for auditing datasets, model artifacts, and inference outputs across ML pipelines.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ TRUSTTRACE CV

Offline-First Integrity Assurance for Computer Vision Assets

Python FastAPI SQLite NumPy Pytest

Status Version License

πŸš€ Quickstart Β β€’Β  πŸ—οΈ Architecture Β β€’Β  βš–οΈ How It Compares Β β€’Β  🧰 Tech Stack


πŸ“– Overview

TRUSTTRACE CV is an offline-first, model-agnostic assurance pipeline designed specifically to secure the computer vision machine learning lifecycle. It delivers deterministic cryptographic verification and advanced statistical heuristics to protect training data, model artifacts, and inference records from tampering, poisoning, and supply-chain attacks.


βš–οΈ How It Compares (Competitive Advantage)

Most open-source ML tools focus heavily on either simple data formatting or post-deployment monitoring. TRUSTTRACE CV bridges the gap by strictly enforcing cryptographic data provenance and advanced security heuristics completely offline.

Here is how TRUSTTRACE CV objectively compares to existing industry standards based on current capabilities:

Capability TRUSTTRACE CV Deepchecks (Vision) CleanVision IBM ART
Primary Focus Integrity & Cryptographic Security Validation & Testing Visual Data Quality Adversarial Attacks
Cryptographic Provenance βœ… Yes (HMAC-SHA256) ❌ No ❌ No ❌ No
Patch-Level Entropy Scans βœ… Yes ❌ No ❌ No βœ… Yes (Indirectly)
Duplicate Flooding Detection βœ… Yes (O(1) SHA-256) ⚠️ Partial (Heuristics) βœ… Yes (Visual) ❌ No
Label Flipping Detection βœ… Yes (Deterministic class_id diff vs reference) βœ… Yes ❌ No βœ… Yes
OOD Detection βœ… Yes (Mahalanobis Distance) βœ… Yes ❌ No ❌ No
Offline-First / Air-Gapped βœ… Native ⚠️ Partial βœ… Native βœ… Native
  • Sources:
    • CleanVision is exceptional for pre-training visual defect detection (blurriness, exposure) but lacks cryptographic pipeline security.
    • Deepchecks is an excellent CI/CD unit testing suite for ML pipelines, but it is not designed to enforce zero-trust cryptographic signatures on inference logs.
    • IBM Adversarial Robustness Toolbox (ART) is the industry standard for adversarial attacks and defenses, but requires heavy computation and is not an end-to-end provenance pipeline. TRUSTTRACE CV can actually wrap ART using our src/integrations/ adapter pattern.

Technology Stack and Frameworks

The system is built entirely using open-source, offline-capable technologies:

  • Core Logic: Python 3.10+
  • API Layer: FastAPI, Uvicorn
  • Database: SQLite3 (for append-only audit event logging)
  • Data Processing: NumPy, Pillow (PIL), JSON parsing libraries
  • Cryptography: built-in hashlib, hmac
  • Testing: Pytest

System Architecture

The following diagram illustrates the flow of data and execution through the TRUSTTRACE CV pipeline:

graph TD
    A[User / Web UI] -->|Upload Dataset / Artifacts| B[FastAPI Backend]
    B --> C[Dataset Inspector]
    B --> D[Model Validator]
    B --> E[Inference Verifier]
    
    C --> C1[YOLO/COCO Parser]
    C --> C2[Security Heuristics]
    
    D --> D1[Manifest Hashing]
    D --> D2[Structure Loader]
    
    E --> E1[HMAC-SHA256 Validator]
    E --> E2[Replay Deduplication]
    
    C2 --> F[Audit Event Logger]
    D1 --> F
    D2 --> F
    E1 --> F
    E2 --> F
    
    F -->|Log entries| G[(SQLite Database)]
    G --> H[HTML Report Generator]
    H -->|Self-Contained Offline Evidence| A
Loading

Key Capabilities

  1. Dataset Duplicate Flooding: Uses SHA-256 digests to instantly detect and flag duplicated assets.
  2. Dataset Format Validation: Strict structural validation of YOLO and COCO schema annotations.
  3. Label Flipping Detection: Deterministically compares class IDs annotation-by-annotation against a trusted reference annotation set to detect targeted poisoning. Z-score analysis is used separately for pixel distribution outlier detection (data poisoning).
  4. Trigger Pattern Detection: Advanced patch-level Shannon entropy scans to uncover solid/zero-entropy backdoor triggers.
  5. Out-of-Distribution (OOD) Detection: Flags statistical outliers across pixel distributions.
  6. Model Identity Verification: Validates PyTorch, TorchScript, and ONNX models against strict cryptographic reference manifests.
  7. Inference Tamper Detection: Cryptographically signs inference logs to completely eliminate replay attacks and tampering.

Mathematical and Cryptographic Models

The integrity engine relies on several fundamental mathematical calculations to flag anomalies:

1. Out-of-Distribution (OOD) Detection

OOD samples are detected by computing the Mahalanobis Distance of a given image's pixel feature vector against the global dataset distribution.

  • Equation: D_M(x) = sqrt((x - ΞΌ)^T * Ξ£^-1 * (x - ΞΌ))
  • Where:
    • x is the feature vector of the evaluated image.
    • ΞΌ is the mean vector of the dataset.
    • Ξ£^-1 is the inverse covariance matrix.

2. Backdoor Trigger Detection

Suspected backdoor triggers (e.g., solid color patches) are identified by analyzing the Shannon Entropy of local pixel regions (20x20 windows). Regions with entropy approaching zero indicate unnatural, synthetic overlays.

  • Equation: H(X) = - Ξ£ ( P(x_i) * log2(P(x_i)) )
  • Where:
    • P(x_i) is the probability of a pixel intensity occurring within the localized patch.

3. Data Poisoning & Label Variance

To detect systematic label flipping, the system calculates standard Z-scores for class distributions.

  • Equation: Z = (x - ΞΌ) / Οƒ
  • Where:
    • x is the frequency of the class in the provided data.
    • ΞΌ and Οƒ are the expected mean and standard deviation of class distributions.

4. Inference Provenance (Tamper Detection)

Each inference event is sealed using a Hash-based Message Authentication Code (HMAC) to ensure predictions cannot be altered post-execution.

  • Equation: HMAC(K, m) = H((K βŠ• opad) || H((K βŠ• ipad) || m))
  • Where:
    • H is the SHA-256 cryptographic hash function.
    • K is the secret cryptographic signing key.
    • m is the payload (model ID, prediction, confidence, bounding boxes).

Quickstart Guide

Prerequisites

  • Operating System: Windows, Linux, or macOS
  • Python: 3.10 or higher

Installation

  1. Clone the repository:

    git clone https://github.com/x2ankit/trusttracecv.git
    cd trusttracecv
  2. Setup your environment:

    conda create -n trusttrace python=3.10
    conda activate trusttrace
    pip install -r requirements.txt
  3. Configure Environment:

    cp .env.example .env
  4. Run the Application:

    python run_server.py

    Navigate to http://localhost:8000 to access the web dashboard.

Extensibility

We developed TRUSTTRACE CV with an Adapter Pattern (src/integrations/) to easily interface with leading industry open-source security tools. These adapters ensure that when the environment supports it, we can delegate computations seamlessly via their Python APIs, while falling back gracefully in completely offline or isolated environments without bloating the core repository.

Testing

TRUSTTRACE CV is backed by a rigorous automated test suite relying on fully reproducible synthetic datasets.

pytest tests/ -v

Documentation

For deep dives into methodologies, constraints, and architecture:


User Interface

Below is a preview of the TRUSTTRACE CV Dataset Assurance Dashboard in action.

TRUSTTRACE CV UI Screenshot

πŸ“œ License

This project is licensed under the MIT License.
See the LICENSE file for full details.

License: MIT

About

An offline-first computer vision integrity and security assurance platform for auditing datasets, model artifacts, and inference outputs across ML pipelines.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages