Spaces:
Running
on
Zero
A newer version of the Gradio SDK is available:
6.1.0
title: Generative Inference Demo
emoji: 🧠
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 5.23.1
app_file: app.py
pinned: false
license: mit
Generative Inference Demo
This Gradio demo showcases how neural networks perceive visual illusions through generative inference. The demo uses both standard and robust ResNet50 models to reveal emergent perception of contours, figure-ground separation, and other visual phenomena.
Models
- Robust ResNet50: A model trained with adversarial examples (ε=3.0), exhibiting more human-like visual perception
- Standard ResNet50: A model trained without adversarial examples (ε=0.0)
Features
- Upload your own images or use example illusions
- Choose between robust and standard models
- Adjust perturbation size (epsilon) and iteration count
- Visualize how perception emerges over time
- Includes classic illusions:
- Kanizsa shapes
- Face-Vase illusions
- Figure-Ground segmentation
- Neon color spreading
Usage
- Select an example image or upload your own
- Choose the model type (robust or standard)
- Adjust epsilon and iteration parameters
- Click "Run Inference" to see how the model perceives the image
About
This demo is based on research showing how adversarially robust models develop more human-like visual representations. The generative inference process reveals these perceptual biases by optimizing the input to maximize the model's confidence.
Installation
To run this demo locally:
# Clone the repository
git clone [repo-url]
cd GenerativeInferenceDemo
# Install dependencies
pip install -r requirements.txt
# Run the app
python app.py
The web app will be available at http://localhost:7860 (or another port if 7860 is busy).
About the Models
- Robust ResNet50: A model trained with adversarial examples, making it more robust to small perturbations. These models often exhibit more human-like visual perception.
- Standard ResNet50: A standard ImageNet-trained ResNet50 model.
How It Works
- The algorithm starts with an input image
- It iteratively updates the image to increase the model's confidence in its predictions
- These updates are constrained to a small neighborhood (controlled by epsilon) around the original image
- The resulting changes reveal how the network "sees" the image
Citation
If you use this work in your research, please cite the original paper:
[Citation information will be added here]
License
This project is licensed under the MIT License - see the LICENSE file for details.