Neural-Image-Captioning-Model
Image Captioning Systems Evolution from CNN-LSTM to Vision Transformers
2 min read
This project is a complete deep learning system built with PyTorch that explores and compares the evolution of image captioning models using the Flickr8k dataset. The system features classic ResNet-50 and LSTM architectures as well as modern Vision Transformer (ViT-B/16) solutions with adaptive attention control mechanisms. It is designed for computer vision and text processing developers and researchers who want to test different caption generation approaches.
Key features
- ViT-B/16 — utilizing a visual transformer for global context and high texture detail.
- Adaptive Visual Sentinel Gating — a special mechanism that splits attention between visual objects and syntactic words.
- Flickr8k benchmark — rigorous evaluation using BLEU and ROUGE-L metrics on a test split of 1,091 images.
- Frequency-Aware Beam Search — a search algorithm to prevent language repetition and include rare descriptive tokens.
What you can do
- Run inference via CLI to generate a caption for a single image using ViT or the adaptive model.
- Deploy an interactive web application locally via Streamlit.
- Publish the completed project as a public demo on Hugging Face Spaces using Gradio.
- Run training or evaluation of various architectures on your own data or the Flickr8k dataset.
Example
Running image caption prediction using the Vision Transformer model:
python predict.py --image "sample.jpg" --checkpoint "checkpoints/vit_transformer/best_model.pth" --model vit_transformerRead more
Details• Architecture: Comparison of Baseline (ResNet-50 + LSTM), Adaptive Spatial Attention, and ViT-B/16.
• Metrics: ViT-B/16 achieves a BLEU-4 score of 22.17 and ROUGE-L of 45.62.
• Parameters: from ~25.5 million for the baseline model to ~98.4 million for ViT.
• License: MIT.










Comments