SalHargis's picture
Update README.md
9777e44 verified

A newer version of the Gradio SDK is available: 6.12.0

Upgrade
metadata
title: Wildlife Re-Identification Demo
emoji: 🐾
colorFrom: green
colorTo: indigo
sdk: gradio
sdk_version: 6.5.1
app_file: app.py
pinned: false
license: apache-2.0
short_description: Pipeline for individual animal identification.

Wildlife Re-Identification: A Coarse-to-Fine Approach

Welcome to the Wildlife Re-ID Demo! This tool demonstrates a two-step AI pipeline designed to identify individual animals (like "Marty the Zebra" or "Snowball the Bear") from photographs.

It uses a "Coarse-to-Fine" architecture, first narrowing down the list of suspects, and then carefully verifying the details.

How It Works

This system does not just look at the image once. It uses two different AI models working together.

Step 1: The "Coarse" Search (ArcFace)

Goal: Find the most likely candidates quickly.

  • The Model: A ResNet50 neural network trained with ArcFace Loss.
  • The Process:
    1. The model looks at the input image and summarizes it into a list of 512 numbers (an "embedding").
    2. It compares this embedding against the known animals in our gallery.
    3. It mathematically calculates which known animals are "closest" to the new photo.
  • Analogy: Imagine scanning a crowd and saying, "Okay, that looks roughly like Marty, or maybe Alex." It's fast, but it might get confused by similar-looking animals.

Step 2: The "Fine" Verification (LightGlue)

Goal: Verify the identity by checking the details.

  • The Model: LightGlue (deep feature matcher).
  • The Process:
    1. The system takes the Top 3 unique candidates from Step 1.
    2. It looks at the original images pixel-by-pixel to find matching geometric features (like the corner of an eye, a specific stripe pattern, or an ear notch).
    3. It draws green lines connecting these matching points.
  • Analogy: Taking out a magnifying glass and saying, "Let me check the stripe pattern on the shoulder to be 100% sure."

Understanding the Output

When you run the demo, you will see three results for every query:

  1. Candidate 1: The best guess from the Coarse (ArcFace) model.
  2. Candidate 2 & 3: The next best unique individuals (the "runners-up").

What do the numbers mean?

  • Coarse Confidence: How similar the "summary" of the face is (0-100%).
  • Geometric Matches: The number of physical points that match between the two images.

Technologies Used

  • Framework: PyTorch & Gradio
  • Backbone: ResNet50 (Fine-tuned on MiewID/Unified ReID data)
  • Loss Function: ArcFace (Additive Angular Margin Loss)
  • Re-Ranker: LightGlue (Local Feature Matching)

About the Project

This demo explores the intersection of Computer Vision and Cognitive Systems Engineering. By revealing the "runners-up" and visualizing the feature matches, we aim to make the AI's decision-making process transparent and understandable for human users.

Credits

This project was built by Connor Kannally and Sal Hargis at The Ohio State University under Dr. Wei-Lun (Harry) Chao