Skip to content

AdityaDharawat/Image-Captioning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Image Captioning Web App

An AI-powered web application that generates human-like captions from uploaded images using deep learning and computer vision.


✨ Latest Update - May 10, 2026

🎯 Critical Fix: Image Upload Bug Resolved

The application now supports unlimited sequential image uploads without crashes!

Fixed Issues:

  • "Cannot identify image file" error - Completely eliminated
  • Second upload crashes - Now works perfectly
  • Stale file references - Proper stream management
  • Format switching - JPG/PNG seamlessly supported

What's New:

  • Safe image byte handling with BytesIO streams
  • Hash-based duplicate detection
  • User-friendly error messages
  • Proper session state management

For detailed information, see:


🚀 Features

  • 📸 Upload any .jpg, .jpeg, or .png image
  • 🧠 Deep learning-based caption generation with EfficientNet + LSTM + Attention
  • ✨ Beam Search decoding for better results
  • 🎨 Modern Streamlit UI with gradients, hover animations, and Lottie animations
  • 💬 Clear and interactive output with CTA buttons
  • 🔄 [NEW] Support unlimited sequential image uploads without crashes
  • 🛡️ [NEW] Safe image handling with robust error recovery
  • 🔍 [NEW] Smart upload detection and validation

🛠️ Tech Stack

Layer Tools Used
Frontend Streamlit, Lottie, HTML/CSS
Backend Python, TensorFlow, NumPy, Pillow
Model EfficientNetB0 (Encoder), LSTM (Decoder)
Dataset MS COCO captions dataset

🖼️ Demo Preview


⚙️ How to Run Locally

# Clone the repository
git clone https://github.com/AdityaDharawat/Image-Captioning.git
cd Image-Captioning

# Install dependencies
pip install -r requirements.txt

# Run the app
streamlit run app.py

🔔 Make sure image_captioning_model.keras and tokenizer.pkl are present in the root directory.


🧪 Model Architecture

  • Encoder: Pretrained EfficientNetB0
  • Decoder: LSTM + Attention mechanism
  • Trained on: MS COCO Dataset
  • Evaluation: BLEU score, manual inspection

📁 Project Structure

ImageCaptioning/
├── app.py
├── generate_caption.py
├── image_captioning_model.keras
├── tokenizer.pkl
├── assets/
│   └── style.css
│   └── animation.json
├── README.md

🙌 Credits


📢 License

This project is open-source and available under the MIT License.


👨‍💻 Made with 💜 by Aditya Dharawat

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors