Umaim/image-captioning-seq2seq
1
๐ผ๏ธ Image Caption Generator
An AI-powered image captioning application using ResNet-50 encoder and LSTM decoder with attention mechanism.
Features
- ResNet-50 Encoder: Extracts visual features from images
- LSTM Decoder: Generates captions with attention mechanism
- Two Decoding Strategies:
- Greedy Search: Fast, picks most probable word at each step
- Beam Search: Explores multiple candidates for richer captions
- Beautiful Dark Theme UI: Modern, responsive interface
Model Architecture
- Image โ ResNet-50 (pretrained)
- Features โ Linear Encoder (2048 โ 512)
- Decoder โ LSTM with Embedding (300d) + Attention
- Output โ Natural language caption
Training
- Dataset: Flickr8k
- Vocabulary Size: Dynamic (from training data)
- Max Caption Length: 20 tokens
Usage
- Upload an image (JPG, PNG, or JPEG)
- Select decoding strategy (Greedy or Beam Search)
- Click "Generate Caption"
- View the AI-generated description
Technical Stack
- PyTorch - Deep learning framework
- Streamlit - Web interface
- torchvision - Pre-trained ResNet-50
- NLTK - Text processing
Files
app.py- Main Streamlit applicationcaption_model.pkl- Trained encoder/decoder weights + vocabularyrequirements.txt- Python dependenciesDockerfile- Container configuration for deployment
Local Development
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run app.pyAcknowledgments
Built with โค๏ธ using PyTorch and Streamlit
