Skip to content

About

A comprehensive computer vision and AI platform covering 35+ concepts including YOLOv8 detection, Segformer segmentation, CLIP, ViT, and multi-agent AI. Runs entirely locally with no API keys.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฎ VisionAI Pro

Comprehensive Computer Vision & AI Analysis Platform

Python PyTorch Gradio License HuggingFace


Features ยท Quick Start ยท Architecture ยท Concepts Covered ยท Deployment


โœจ Features

๐ŸŽฏ 1. Real-Time Object Detection (YOLOv8)

  • 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

๐ŸŽจ 2. Semantic Segmentation (Segformer)

  • 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

๐Ÿ‘๏ธ 3. Real-Time Vision Assistant

  • Face detection using Haar cascades
  • Emotion recognition via CNN classifier
  • Scene statistics: brightness, contrast, edge density
  • Concepts: Face Detection, Emotion Recognition, Image Processing, Classification

๐Ÿ”— 4. CLIP Vision-Language Analysis

  • 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

๐Ÿท๏ธ 5. ViT Image Classification

  • 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

๐Ÿ“Š 6. Traditional ML Pipeline

  • 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

๐Ÿงช 7. Custom Neural Network Demo

  • 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

๐Ÿ“ 8. NLP & Text Analysis

  • 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

๐Ÿค– 9. Multi-Agent AI System

  • 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

๐ŸŽฌ 10. Video Understanding

  • Frame-by-frame YOLO detection on uploaded videos
  • Temporal object frequency analysis
  • Concepts: Video Understanding, Temporal Analysis

๐Ÿ–ผ๏ธ Sample Output

YOLOv8 object detection โ€” bounding boxes with class labels and confidence scores, rendered live next to the uploaded image:

Detection sample 1

The results panel also reports the inference device, confidence threshold, and a per-detection table with class, confidence, and bounding-box coordinates:

Detection sample 2


๐Ÿš€ Quick Start

Prerequisites

  • Python 3.9 or higher
  • pip (Python package manager)
  • ~2 GB free disk space (for model weights, downloaded on first use)

Installation

# 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.py

The app will start at http://localhost:7860. Models are downloaded automatically on first use.

Quick Launch (one command)

pip install -r requirements.txt && python app.py

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿ”ฎ 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         โ”‚     โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Project Structure

visionai-pro/
โ”œโ”€โ”€ app.py              # Single-file application (all code)
โ”œโ”€โ”€ requirements.txt    # Python dependencies
โ”œโ”€โ”€ README.md           # This file
โ””โ”€โ”€ .gitignore          # Git ignore rules

Model Details

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.


๐Ÿ“š Concepts Covered

This project demonstrates 35+ AI/ML concepts across 7 categories:

Computer Vision

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

Deep Learning Fundamentals

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

Transformers & Attention

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

Vision-Language Models

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

Traditional ML

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

NLP & Language

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

Modern AI / Agentic Systems

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

๐ŸŒ Deployment

Option 1: Local (Recommended for Development)

python app.py
# Opens at http://localhost:7860

Option 2: Temporary Public URL

# In app.py, change the launch line to:
app.launch(share=True)  # Generates a public Gradio link (72h)

Option 3: Hugging Face Spaces (Free Permanent Hosting)

  1. Create a Hugging Face account
  2. Create a new Space โ†’ select Gradio as the SDK
  3. Upload app.py and requirements.txt
  4. 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
---

Option 4: Docker

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

๐Ÿ› ๏ธ Technology Stack

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

๐Ÿ“‹ Requirements

Requirement Minimum
Python 3.9+
RAM 4 GB (8 GB recommended)
Disk ~2 GB (model downloads)
GPU Optional (runs on CPU)

๐Ÿ“ API Reference

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

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. Open a Pull Request

๐Ÿ“„ License

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

About

A comprehensive computer vision and AI platform covering 35+ concepts including YOLOv8 detection, Segformer segmentation, CLIP, ViT, and multi-agent AI. Runs entirely locally with no API keys.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages