π Quickstart Β β’Β ποΈ Architecture Β β’Β βοΈ How It Compares Β β’Β π§° Tech Stack
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.
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) | β 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 | β 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.
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
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
- Dataset Duplicate Flooding: Uses SHA-256 digests to instantly detect and flag duplicated assets.
- Dataset Format Validation: Strict structural validation of YOLO and COCO schema annotations.
- 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).
- Trigger Pattern Detection: Advanced patch-level Shannon entropy scans to uncover solid/zero-entropy backdoor triggers.
- Out-of-Distribution (OOD) Detection: Flags statistical outliers across pixel distributions.
- Model Identity Verification: Validates PyTorch, TorchScript, and ONNX models against strict cryptographic reference manifests.
- Inference Tamper Detection: Cryptographically signs inference logs to completely eliminate replay attacks and tampering.
The integrity engine relies on several fundamental mathematical calculations to flag anomalies:
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:
xis the feature vector of the evaluated image.ΞΌis the mean vector of the dataset.Ξ£^-1is the inverse covariance matrix.
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.
To detect systematic label flipping, the system calculates standard Z-scores for class distributions.
- Equation:
Z = (x - ΞΌ) / Ο - Where:
xis the frequency of the class in the provided data.ΞΌandΟare the expected mean and standard deviation of class distributions.
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:
His the SHA-256 cryptographic hash function.Kis the secret cryptographic signing key.mis the payload (model ID, prediction, confidence, bounding boxes).
- Operating System: Windows, Linux, or macOS
- Python: 3.10 or higher
-
Clone the repository:
git clone https://github.com/x2ankit/trusttracecv.git cd trusttracecv -
Setup your environment:
conda create -n trusttrace python=3.10 conda activate trusttrace pip install -r requirements.txt
-
Configure Environment:
cp .env.example .env
-
Run the Application:
python run_server.py
Navigate to
http://localhost:8000to access the web dashboard.
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.
TRUSTTRACE CV is backed by a rigorous automated test suite relying on fully reproducible synthetic datasets.
pytest tests/ -vFor deep dives into methodologies, constraints, and architecture:
Below is a preview of the TRUSTTRACE CV Dataset Assurance Dashboard in action.
