File size: 1,994 Bytes
936daf1
8759ac4
 
 
936daf1
 
c39ffd8
badc90c
936daf1
 
8759ac4
936daf1
 
8759ac4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: Assistive Diagnostic Framework for Copyright
emoji: ⚖️
colorFrom: gray
colorTo: blue
sdk: gradio
sdk_version: 6.14.0
python_version: 3.10.14
app_file: app.py
pinned: false
license: mit
---

# Assistive Diagnostic Framework for Copyright Infringement

This prototype application is an "Explainable AI" dashboard designed to assist in evaluating potential visual copyright infringement. Rather than outputting a single, opaque similarity score, this tool processes two images through a multi-model computer vision pipeline to map technical parameters to established legal criteria.

## 🧠 The Architecture

The pipeline divides the visual comparison into three distinct legal dimensions, optimized to run within standard memory constraints (e.g., Hugging Face Free Tier).

1. **Semantic Match (The "Idea" Filter)**
   * **Model:** CLIP (`openai/clip-vit-base-patch32`)
   * **Function:** Compares the overarching semantic concept of the images. This acts as a threshold mechanism to determine if the images share the same unprotected subject matter or "referent" before analyzing specific expressions.

2. **Structural Layout (Substantial Similarity)**
   * **Model:** OpenCV Canny Edge Detection
   * **Function:** Strips away style, texture, and color to compare only the fundamental structural outlines. Calculates the Intersection over Union (IoU) of the edge pixels to assess compositional overlap.

3. **Patch Match (Fragmented Literal Similarity)**
   * **Model:** DINOv2 (`facebook/dinov2-base`)
   * **Function:** Identifies "scattered literal copying." By extracting and normalizing local patch features, the model uses a Mutual Nearest Neighbors algorithm to map identical or near-identical fragments between the two images, regardless of their spatial location.

## 🚀 Running Locally

To run this application on your local machine, ensure you have Python 3.9+ installed.

1. Clone the repository:
   ```bash
   git clone <your-repo-url>
   cd <your-repo-directory>