We present a framework to take advantage of existing labels at inference, called exemplars, in order to improve the performance of object detection in medical images. The method, exemplar diffusion, leverages existing diffusion methods for object detection to enable a training-free approach to adding information of known bounding boxes at test time. We demonstrate that for medical image datasets with clear spatial structure, the method yields an across-the-board increase in average precision and recall, and a robustness to exemplar quality, enabling non-expert annotation. Moreover, we demonstrate how our method may also be used to quantify predictive uncertainty in diffusion detection methods. Source code and data splits openly available online: https://github.com/waahlstrand/ExemplarDiffusion
Figures & tables
Figure 1: Model overview. Diffusion of boxes x through a forward process q and denoising process pθ . Known exemplars x0⋆ are replicated n⋆ times, forward diffused τ steps and inserted into xT . The joint set of proposals is denoised normally by the backward process.
Figure 2: Impact of number of exemplars . Average recall increases with number of exemplars N⋆ , while average precision decreases beyond N⋆=2 , on the DENTEX dataset, where the number of labels is approx. 3.5.
Table 1: Annotation randomness Comparison across datasets with varying spatial entropy H . Metrics reported as the mean on test set over cross-validation folds. Changes compared to the baseline N⋆=0 .
SAM3
SAM3 w. text prompt
Sparse R-CNN
ours
N⋆=0
AP
—
—
28.24±2.60
34.44±2.15
AP50
—
—
43.30±2.96
51.80±2.36
AR
—
—
68.88±0.86
62.00±1.70
N⋆=1
AP
4.74
5.05
28.24±2.60
35.36±2.08
AP50
13.02
14.28
43.30±2.96
53.56±3.07
AR
39.41
37.57
68.88±0.86
64.14±0.94
Table 2: Exemplar model comparison for different numbers of exemplars N⋆∈{0,1,2} in terms of average recall on the DENTEX dataset, the text prompt supplied to SAM3 being “ do not segment healthy teeth ”. Statistical significance ( ∗ ) from baseline ( N⋆=0) using two-sided t -test.
N⋆=1
σ=1
σ=5
σ=10
AP
35.00 +0.6
34.80 +0.4
34.50 +0.0
AP50
52.92 +0.9
52.62 +0.6
52.12 +0.3
AR
63.56 +1.5
63.16 +1.1
63.66 +1.6
Table 3: Robustness to noise. The model shows robustness to adding noise with scale σ to the input exemplar ( N⋆=1) , changes relative to N⋆=0 on DENTEX.
Figure 3: Results visualization . Sample image of teeth detected as diseased by our model ( yellow ) using a known exemplar ( red, dashed ). Ellipses indicate an estimated 95% confidence interval for the box coordinates.