--- title: Image Caption Generator emoji: 👁 colorFrom: red colorTo: yellow sdk: gradio sdk_version: 6.26.0 python_version: '3.12' app_file: app.py pinned: false --- # Image Caption Generator Upload an image and get an automatically generated caption. Built with a **ResNet50 (frozen, transfer learning) + LSTM decoder**, trained on the [Flickr8k dataset](https://www.kaggle.com/datasets/adityajn105/flickr8k). This Space runs the **regularized model checkpoint with beam search decoding** (beam width 3) — the best-performing configuration from the project's optimization experiments (BLEU-4 = 0.1557 on the held-out test set, a ~27% relative improvement over the initial baseline). - **Full project, code, and documentation:** https://github.com/adhamashraf7788/Image-Caption-Generator - **Model weights:** https://huggingface.co/AdhamAshraf/image-caption-generator ## How it works 1. Image is resized/cropped/normalized and passed through a frozen, ImageNet-pretrained ResNet50 to extract a 2048-d feature vector. 2. The feature vector is projected into a 256-d embedding and fed as the first input to an LSTM decoder. 3. The LSTM generates the caption word-by-word using beam search (keeping the top-3 candidate sequences at each step, rather than greedily committing to a single best word). See the [main repo's README](https://github.com/adhamashraf7788/Image-Caption-Generator) for full details on the dataset, architecture, training process, evaluation metrics, and optimization experiments (beam search + regularization comparisons). Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference