NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Transformer based Multitask Learning for Image Captioning and Object Detection

Debolena Basak, P. K. Srijith, Maunendra Sankar DesarkararXiv 2024

TL;DR

The TICOD framework introduces a multitask learning approach that jointly trains image captioning and object detection using a shared Transformer backbone. By optimizing a combined loss function, the model leverages complementary visual information between tasks, resulting in a 3.65% improvement in semantic captioning quality (BERTScore) while maintaining competitive object detection performance.

What Problem Does This Paper Address?

Most modern image captioning systems rely on a two-stage pipeline: first, a pre-trained object detector (like Faster R-CNN) extracts regional features from an image; second, these features are fed into an encoder-decoder network to generate text.

This approach has two major drawbacks. First, the object detector is often trained on different datasets (like Visual Genome) and then frozen, meaning its visual representations aren't optimized for the specific nuances of the captioning task. This leads to "error propagation," where a detector's failure to recognize a key object dooms the caption. Second, extracting these region features is computationally expensive and often relies on pre-computed caches, making real-time, end-to-end deployment difficult.

The authors propose TICOD (Transformer-based Image Captioning and Object Detection) to move toward a single-stage, end-to-end architecture where both tasks inform and improve one another.

Methods

The TICOD architecture consists of three main components integrated into a unified flow:

  1. Backbone Network: The model uses a Swin Transformer as a common encoder. Unlike standard Vision Transformers (ViT), Swin Transformers use a hierarchical structure and shifted windows, making them highly efficient for dense vision tasks like object detection.
  2. Object Detection Network: This branch follows the Cascade R-CNN framework. It takes feature maps from the Swin backbone and passes them through a Feature Pyramid Network (FPN), a Region Proposal Network (RPN), and an RoI pooling layer to predict object classes and bounding boxes.
  3. Caption Network: This branch uses a GPT-2 decoder. It takes the final feature map from the Swin backbone and generates captions word-by-word in an auto-regressive fashion.
Fig. 2: Architectural overview of the proposed Transformer-based Image Captioning and Object Detection (TICOD) model.

The key innovation lies in the joint training. The model is optimized using a combined loss function: $$L^T = L^{Object} + \lambda \cdot L^{Caption}$$ where $\lambda$ is a hyperparameter that balances the two tasks. This allows the "knowledge" gained from identifying specific objects to refine the descriptive capabilities of the captioning branch, and vice versa.

Datasets

The researchers evaluated TICOD on the MS-COCO 2017 dataset, which is the gold standard for these tasks. It contains 118K training images and 5K validation images, each annotated with both bounding boxes for objects and five human-written captions. They followed the standard "Karpathy" split to ensure fair comparison with existing literature.

Key Insights and Ideas

  • Semantic vs. Lexical Evaluation: The authors argue that traditional metrics like BLEU or CIDEr, which look for exact word matches, are flawed because they penalize synonyms. They emphasize BERTScore, which uses contextual embeddings to measure semantic similarity. TICOD excels here, suggesting it captures the meaning of a scene better than models focused solely on lexical overlap.
  • The Power of Joint Training: Ablation studies showed that fine-tuning the backbone for both tasks simultaneously is crucial. When the backbone was frozen, performance dropped significantly. Interestingly, the captioning task actually helped the detection task; the mAP (mean Average Precision) for detection improved slightly when trained alongside captioning.
  • Operational Flexibility: Because the architecture is modular, users can "turn off" the detection branch during inference to generate captions without added latency, or enable both for a comprehensive visual analysis.

Key Results

TICOD demonstrated significant gains in semantic understanding while remaining a top-tier detector:

  • Captioning: TICOD-large achieved a BERTScore of 70.794, outperforming established baselines like PureT (68.303) and $M^2$ Transformer (64.556). This represents a 3.65% improvement over the previous state-of-the-art in semantic similarity.
  • Object Detection: The model achieved an mAP of 52.1, which is comparable to (and in some cases slightly better than) task-specific models like Swin-B Cascade R-CNN (51.9).
Comparison of TICOD against various baselines on the MS-COCO dataset.

Qualitatively, the model proved more descriptive. For instance, in a scene with a stop sign, TICOD correctly identified a "red stop sign," whereas baseline models often produced more generic or slightly inaccurate descriptions.

Limitations and Future Work

While TICOD shows superior semantic performance, its scores on lexical metrics (like BLEU-4) were competitive but did not always surpass specialized captioning-only models like PureT. This suggests a trade-off between exact word matching and broader semantic accuracy.

Additionally, the use of an auto-regressive GPT-2 decoder, while effective, can be slower during inference for very long sequences compared to non-autoregressive alternatives. The authors suggest that future iterations could replace the Swin backbone and GPT-2 decoder with even newer, more powerful specialized Large Language Models (LLMs) to further bridge the gap between vision and language.

Summary updated

BibTeX
@misc{basak2024transformer,
  author = {Debolena Basak and P. K. Srijith and Maunendra Sankar Desarkar},
  title = {{Transformer based Multitask Learning for Image Captioning and Object Detection}},
  year = {2024},
  eprint = {2403.06292},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.06292},
}
Figure