An AI-powered Image Caption Generator that automatically generates meaningful natural language descriptions for images using Computer Vision and Deep Learning. The project combines a CNN encoder (VGG16) for image feature extraction with an LSTM decoder for caption generation.
Image Captioning is a multimodal AI task that combines Computer Vision and Natural Language Processing (NLP). The model learns visual features from images and generates human-like captions describing the content of an image.
This project uses the Flickr8k Dataset for training and evaluation.
- 🖼️ Automatic image caption generation
- 🧠 Deep Learning-based encoder-decoder architecture
- 📷 VGG16 for image feature extraction
- 💬 LSTM for sequence generation
- 📝 Text preprocessing and tokenization
- 📊 BLEU Score evaluation
- 📈 Training using TensorFlow/Keras
- 🔍 Visualize generated captions on test images
| Category | Technologies |
|---|---|
| Language | Python |
| Deep Learning | TensorFlow, Keras |
| Computer Vision | OpenCV, VGG16 |
| NLP | Tokenizer, Padding Sequences |
| Data Processing | NumPy, Pickle |
| Visualization | Matplotlib |
| Dataset | Flickr8k |
Input Image
│
▼
Pretrained VGG16
(Image Feature Extraction)
│
▼
4096-D Feature Vector
│
▼
Dense + Dropout
│
▼
Embedding Layer
│
▼
LSTM Decoder
│
▼
Generated Caption
Dataset: Flickr8k
The dataset contains:
- 8,000 images
- 5 captions for each image
- Thousands of unique vocabulary words
- Load Flickr8k dataset
- Extract image features using VGG16
- Clean and preprocess captions
- Tokenize text
- Create vocabulary
- Generate training sequences
- Build CNN-LSTM model
- Train the model
- Generate captions for unseen images
- Evaluate using BLEU Score
The model performance is evaluated using the BLEU (Bilingual Evaluation Understudy) Score, which compares generated captions with the ground truth captions.
Evaluation metrics include:
- BLEU-1
- BLEU-2
- BLEU-3
- BLEU-4
Image-Caption-Generator/
│
├── Image_caption_generator.ipynb
├── Flickr8k_Dataset/
├── captions.txt
├── features.pkl
├── best_model.h5
├── README.md
└── requirements.txt
Clone the repository:
git clone https://github.com/yourusername/Image-Caption-Generator.gitMove into the project folder:
cd Image-Caption-GeneratorInstall the required packages:
pip install -r requirements.txtRun the Jupyter Notebook:
jupyter notebookInput Image
(Add a sample image here)
Generated Caption
"A young boy is playing football on a grassy field."
- Image Understanding
- Accessibility for Visually Impaired Users
- Smart Photo Albums
- Image Search
- Digital Asset Management
- AI-powered Content Generation
- Replace VGG16 with EfficientNet or Vision Transformer (ViT)
- Use Attention Mechanism
- Integrate Transformer-based Caption Generator
- Deploy using Streamlit or Flask
- Support real-time image uploads
- Improve caption quality using larger datasets
Sanjai K
- 🎓 MCA Graduate (2026)
- 🤖 AI / Machine Learning Engineer
- 📚 IEEE Conference Published Researcher
Portfolio: https://sanjaikmca.github.io/Sanjai_Portfolio/
LinkedIn: https://www.linkedin.com/in/sanjaikmca
GitHub: https://github.com/sanjaikmca