Features ยท Quick Start ยท Architecture ยท Concepts Covered ยท Deployment
- Detect and locate 80+ object classes in images
- Adjustable confidence threshold with bounding-box visualisation
- Uses YOLOv8-nano for fast inference
- Concepts: YOLO, CNNs, Loss Functions (CIoU+BCE+DFL), NMS, Transfer Learning
- Pixel-level scene understanding with 150 ADE20K classes
- Colour-coded segmentation maps + transparent overlays
- Hierarchical Transformer encoder with MLP decoder
- Concepts: Semantic Segmentation, U-Net (Encoder-Decoder), Skip Connections, Bilinear Upsampling
- Face detection using Haar cascades
- Emotion recognition via CNN classifier
- Scene statistics: brightness, contrast, edge density
- Concepts: Face Detection, Emotion Recognition, Image Processing, Classification
- Zero-shot image classification with custom labels
- Image-text cosine similarity measurement
- No fine-tuning required for any target domain
- Concepts: CLIP, Cross-Attention, Contrastive Loss, Zero-shot, Prompt Engineering, VLM
- 1000-class ImageNet classification via Vision Transformer
- Self-attention over 16ร16 image patches
- Concepts: Vision Transformer, Self-Attention, Multi-Head Attention, Position Embeddings, [CLS] Token
- CNN feature extraction โ PCA โ classifier comparison
- Logistic Regression, SVM (RBF + Linear), Decision Tree, Random Forest
- Bias-Variance trade-off analysis per classifier
- Concepts: Logistic/Linear Regression, SVM, Decision Trees, Random Forests, PCA, Cross-Validation, Overfitting/Underfitting
- Build a CNN from scratch with Conv, BatchNorm, Dropout, ReLU
- Live backpropagation training loop with gradient tracking
- Activation function reference table
- Concepts: Perceptron, Neural Networks, CNNs, Backpropagation, Loss Functions, Activation Functions, Regularisation, Dropout, Batch Normalisation
- Auto-generate image descriptions using CLIP
- N-gram analysis (unigram, bigram, trigram)
- Word embeddings via CLIP text encoder + similarity matrix
- Concepts: Word Embeddings, N-gram Models, Context Capturing, Cosine Similarity, Tokenisation
- 4 specialised agents: Detection, Segmentation, Classification, Vision-Language
- Full ReAct loop: Observe โ Think โ Act โ Reflect
- RAG-style knowledge retrieval and synthesis
- Cross-agent improvement loop
- Concepts: Multi-Agent Systems, Single Agent Framework, ReAct, Chain of Thought, Tool Use, Function Calling, RAG, Improvement Loops, Agentic Workflows
- Frame-by-frame YOLO detection on uploaded videos
- Temporal object frequency analysis
- Concepts: Video Understanding, Temporal Analysis
YOLOv8 object detection โ bounding boxes with class labels and confidence scores, rendered live next to the uploaded image:
The results panel also reports the inference device, confidence threshold, and a per-detection table with class, confidence, and bounding-box coordinates:
- Python 3.9 or higher
- pip (Python package manager)
- ~2 GB free disk space (for model weights, downloaded on first use)
# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/visionai-pro.git
cd visionai-pro
# 2. (Recommended) Create a virtual environment
python -m venv venv
source venv/bin/activate # macOS / Linux
# venv\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txt
# 4. Launch the application
python app.pyThe app will start at http://localhost:7860. Models are downloaded automatically on first use.
pip install -r requirements.txt && python app.pyโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฎ VisionAI Pro โ
โ Gradio Web Interface โ
โ โโโโโโโโฌโโโโโโโฌโโโโโโโฌโโโโโโโฌโโโโโโโฌโโโโโโโฌโโโโโโโ โ
โ โ YOLO โ Seg โ Face โ CLIP โ ViT โ ML โAgent โ โ
โ โ Det โment โEmot. โ VLM โClass โPipe. โMulti โ โ
โ โโโโฌโโโโดโโโฌโโโโดโโโฌโโโโดโโโฌโโโโดโโโฌโโโโดโโโฌโโโโดโโโฌโโโโ โ
โ โ โ โ โ โ โ โ โ
โ โโโโผโโโโโโโผโโโโโโโผโโโโโโโผโโโโโโโผโโโโโโโผโโโโโโโผโโโโ โ
โ โ ModelManager (Lazy Loading) โ โ
โ โ YOLOv8 โ Segformer โ CLIP โ ViT โ ResNet โ FERโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ PyTorch + Transformers + OpenCV โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
visionai-pro/
โโโ app.py # Single-file application (all code)
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โโโ .gitignore # Git ignore rules
| Model | Task | Parameters | Source |
|---|---|---|---|
| YOLOv8-nano | Object Detection | 3.2 M | Ultralytics |
| Segformer-B0 | Semantic Segmentation | 3.7 M | NVIDIA / HuggingFace |
| CLIP ViT-B/32 | Vision-Language | 151 M | OpenAI / HuggingFace |
| ViT-B/16-224 | Image Classification | 86 M | Google / HuggingFace |
| ResNet-18 | Feature Extraction | 11 M | torchvision |
| FER CNN | Emotion Recognition | ~5 M | HuggingFace |
All models are open-source and downloaded from HuggingFace Hub or Ultralytics โ no API keys required.
This project demonstrates 35+ AI/ML concepts across 7 categories:
| Concept | Where in Code |
|---|---|
| Object Detection | detect_objects() โ YOLOv8 |
| Image Segmentation | segment_image() โ Segformer |
| Image Classification | vit_classify() โ ViT |
| Face Detection | vision_assistant() โ Haar cascade |
| Video Understanding | process_video() โ frame analysis |
| Concept | Where in Code |
|---|---|
| CNNs | VisionCNN class, YOLO backbone |
| Perceptron / Neural Networks | VisionCNN FC layers |
| Backpropagation | nn_demo() โ loss.backward() |
| Loss Functions | CrossEntropyLoss, CIoU, BCE |
| Activation Functions | ReLU, Sigmoid, Tanh, GELU, SiLU |
| Batch Normalisation | nn.BatchNorm2d in VisionCNN |
| Dropout | nn.Dropout / nn.Dropout2d |
| Regularisation | L2 weight decay in Adam optimiser |
| Overfitting / Underfitting | ML pipeline bias-variance analysis |
| Concept | Where in Code |
|---|---|
| Self-Attention | ViT patch-to-patch attention |
| Cross-Attention | CLIP image-text alignment |
| Multi-Head Attention | ViT encoder layers |
| Vision Transformer (ViT) | vit_classify() |
| Position Embeddings | ViT spatial encoding |
| Concept | Where in Code |
|---|---|
| CLIP | clip_analyze() |
| Zero-shot Classification | CLIP with custom labels |
| Few-shot Prompts | CLIP agent category prompts |
| Prompt Engineering | Label design in CLIP & agents |
| Contrastive Learning | CLIP's InfoNCE training |
| Concept | Where in Code |
|---|---|
| Logistic Regression | ml_pipeline() |
| Linear Regression | ml_pipeline() |
| SVM (RBF + Linear) | ml_pipeline() |
| Decision Trees | ml_pipeline() |
| Random Forests | ml_pipeline() |
| Cross-Validation | 5-fold CV in ml_pipeline() |
| PCA | Dimensionality reduction |
| Bias-Variance Trade-off | Classifier diagnosis |
| Concept | Where in Code |
|---|---|
| Word Embeddings | CLIP text encoder โ 512-d vectors |
| N-gram Models | nlp_analysis() uni/bi/trigrams |
| Context Capturing | Cosine similarity between embeddings |
| Tokenisation | Word-level splitting |
| Concept | Where in Code |
|---|---|
| Single Agent Framework | BaseAgent class |
| Multi-Agent System | Orchestrator + 4 agents |
| ReAct Pattern | Observe โ Think โ Act โ Reflect |
| Chain of Thought | Step-by-step reasoning traces |
| Tool Use / Function Calling | Agents call ML models as tools |
| RAG | Knowledge retrieval + synthesis |
| Improvement Loops | Cross-agent validation |
| Transfer Learning | All pretrained model usage |
| Agentic Workflows | Multi-phase orchestration |
| API Endpoints | Gradio auto-generates REST APIs |
python app.py
# Opens at http://localhost:7860# In app.py, change the launch line to:
app.launch(share=True) # Generates a public Gradio link (72h)- Create a Hugging Face account
- Create a new Space โ select Gradio as the SDK
- Upload
app.pyandrequirements.txt - The Space will auto-build and deploy
# Optional: Create a README.md in the Space with this header
---
title: VisionAI Pro
emoji: ๐ฎ
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 4.0.0
app_file: app.py
pinned: true
---FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py .
EXPOSE 7860
CMD ["python", "app.py"]docker build -t visionai-pro .
docker run -p 7860:7860 visionai-pro| Layer | Technology |
|---|---|
| Deep Learning | PyTorch, torchvision |
| Models | HuggingFace Transformers, Ultralytics |
| Computer Vision | OpenCV |
| Traditional ML | scikit-learn |
| Web UI + API | Gradio |
| Image Processing | Pillow, NumPy |
| Requirement | Minimum |
|---|---|
| Python | 3.9+ |
| RAM | 4 GB (8 GB recommended) |
| Disk | ~2 GB (model downloads) |
| GPU | Optional (runs on CPU) |
Gradio automatically creates REST API endpoints for every function. After launching, visit:
http://localhost:7860/?view=api
Available endpoints:
| Endpoint | Function | Input | Output |
|---|---|---|---|
/api/detect_objects |
Object Detection | Image, float | Image, string |
/api/segment_image |
Segmentation | Image | Image, Image, string |
/api/vision_assistant |
Face + Emotion | Image | Image, string |
/api/clip_analyze |
CLIP Analysis | Image, string, string | string ร3 |
/api/vit_classify |
ViT Classification | Image | string ร2 |
/api/ml_pipeline |
ML Comparison | Image | string |
/api/nn_demo |
Neural Net Demo | Image | string |
/api/nlp_analysis |
NLP Analysis | Image, string | string |
/api/run_multi_agent |
Multi-Agent | Image | string |
/api/process_video |
Video Analysis | Video | string, Video |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
This project is licensed under the MIT License โ see the LICENSE file for details.
Built with โค๏ธ using PyTorch ยท Transformers ยท Ultralytics ยท OpenCV ยท Gradio
All models run locally โ no external API keys required

