Knowledge Amalgamation for Object Detection With Transformers

Haofei Zhang, Feng Mao, Mengqi Xue, Gongfan Fang, Zunlei Feng, Jie Song, Mingli Song

TL;DR

This paper introduces a novel framework for Knowledge Amalgamation (KA) specifically designed for transformer-based object detectors like DETR. By combining "Sequence-level Amalgamation" (mimicking internal teacher representations) and "Task-level Amalgamation" (mimicking final predictions), the authors successfully train a single, compact student model that masters multiple heterogeneous tasks from specialized teachers, often outperforming the teachers themselves.

What Problem Does This Paper Address?

In the world of deep learning, we often have "specialist" models—one trained to detect vehicles, another for animals, and a third for household items. Knowledge Amalgamation (KA) is the process of taking these specialized "teachers" and transferring their collective expertise into a single, "multi-talented" student model.

While KA has been studied extensively for Convolutional Neural Networks (CNNs), the rise of Vision Transformers (ViTs) presents a new challenge. Previous KA methods typically rely on "feature aggregation," where intermediate features from multiple teachers are projected into a fixed-size space for the student to mimic. The authors found that this approach fails for transformers; the linear projections used to squash features together introduce too much noise, leading to severe performance degradation. Transformers, which rely on global attention across sequences of data, require a more nuanced approach to learning from multiple sources.

Methods

The authors propose a two-pronged strategy tailored to the architectural strengths of transformers:

  1. Sequence-level Amalgamation (SA): Instead of forcing teacher features into a single aggregated "hint," the student's internal sequences are extended to match the concatenated sequences of all teachers. To prevent different teacher "know-how" from interfering with each other during the forward pass, they use a specialized attention mask. This ensures that the part of the student sequence meant to learn from "Teacher A" doesn't get distracted by "Teacher B."
  2. Task-level Amalgamation (TA): This focuses on the final output. The student learns to mimic the "soft targets" (the probability distributions and bounding box coordinates) predicted by the teachers. Because a student might predict an object that any one of the teachers also predicted, the authors use a Hungarian matching algorithm to optimally pair student predictions with the most relevant teacher predictions for supervision.
  3. Redundancy-based Compression: Concatenating sequences from many teachers makes the model computationally expensive ($O(N)$ complexity). To fix this, the authors developed a compression algorithm that identifies and removes redundant "vision tokens" (parts of the image sequence that don't contribute much information), bringing the complexity back down to a constant level ($O(1)$) without sacrificing much accuracy.

Datasets

The researchers evaluated their method on two gold-standard object detection benchmarks:

  • PASCAL VOC: 20 object categories. They split these into subsets (e.g., two teachers with 10 categories each, or four teachers with 5 each) to simulate heterogeneous tasks.
  • MS COCO: 80 object categories. They partitioned these into two sets of 40 to test the model's ability to scale to more complex environments.

Key Insights and Ideas

  • Aggregation is the Enemy of Transformers: The "aha moment" here is that transformers are far more sensitive to the noise introduced by feature projection than CNNs. By switching from aggregating features to concatenating sequences, the authors preserved the integrity of the teachers' knowledge.
  • SA as a "Warm-up": The researchers found that Sequence-level Amalgamation acts as a powerful initialization tool. It helps the student model converge much faster than training from scratch, effectively acting as a targeted form of pre-training.
  • The Power of Soft Targets: In object detection, ground-truth labels are "hard" (it's either a dog or it isn't). Teachers provide "soft" targets (it's 90% dog, 8% cat). This "dark knowledge" helps the student understand the relationships between categories and leads to better generalization.

Key Results

The proposed method showed significant improvements over baseline models trained from scratch:

  • PASCAL VOC: The student model achieved an Average Precision (AP) of 49.94, a massive +5.00 point increase over the baseline. Remarkably, the student even outperformed the "Ensemble" (the combined results of the individual teachers) by 1.05 points.
  • MS COCO: The student achieved 37.08 AP, a +4.44 point increase over the baseline.
  • Efficiency: Even with the "slim" version (using sequence compression), the student maintained most of its performance gains while keeping computational costs (FLOPs) nearly identical to a standard, non-amalgamated model.
  • Label-free Learning: The method proved robust even when ground-truth labels were removed, relying solely on teacher supervision (though using labels still yielded the best results).

Limitations and Future Work

  • Training Overhead: While the final student model is compact and efficient, the training process requires running multiple teacher models simultaneously, which increases the initial computational burden.
  • Teacher Quality Dependency: The student's performance is inherently capped by the quality of the teachers. If the teachers have systematic biases or errors, the student will likely inherit them.
  • Scaling to "Many" Teachers: While the compression algorithm helps, the paper primarily tests cases with 2 to 4 teachers. Future work could explore how this scales to dozens of specialized micro-models in a "model zoo" environment.

Summary updated

BibTeX
@article{zhang2023knowledge,
  author = {Haofei Zhang and Feng Mao and Mengqi Xue and Gongfan Fang and Zunlei Feng and Jie Song and Mingli Song},
  title = {{Knowledge Amalgamation for Object Detection With Transformers}},
  journal = {IEEE Trans. Image Process.},
  year = {2023},
  url = {https://openreview.net/forum?id=mNquXeqAQsq},
}
Figure