wikillm

Paper · 2024-05-16 · cs.CV

SpecDETR: A transformer-based hyperspectral point object detection network

SpecDETR drops the backbone of DINO and runs a 6-layer transformer over every pixel of a hyperspectral cube, predicting boxes and classes for tiny point objects. It adds self-excited deformable attention, a hybrid one-to-many assigner and center-shifting contrastive denoising, and keeps NMS. Author-reported: 0.856 mAP on simulated SPOD, above DINO with Swin-L (0.757).

Object detectionDirect set predictionBipartite matching for set-prediction lossesObject queries (learned query slots in transformer decoders)object-detectionhyperspectraltransformerset-predictionremote-sensing

arXivPDFCodeMarkdown28 min read

AI-compiled by claude-haiku-5-5 on 2026-11-06, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

A hyperspectral camera records a long list of light measurements for every pixel, not just red, green and blue. Some targets are smaller than one pixel, so they show up only as a faint mix of materials inside a pixel. The usual approach labels each pixel as "target" or "background" using a known spectrum of the target. It finds where a material is, but it does not return separate objects.

SpecDETR treats the whole image cube as a set of pixel tokens and reads it with a transformer. Its output is a set of boxes, each with one of eight simulated object classes. It is built on an object detector called DINO, but it removes the image backbone that normally shrinks the picture. Keeping full resolution matters for objects that are tiny.

Training uses simulated scenes with exact labels, because hand-labelling mixed pixels is unreliable. The network learns to predict several overlapping boxes for one object and then uses a final clean-up step to remove the duplicates.

TL;DR

  • SpecDETR is a DETR-style transformer detector for hyperspectral point objects, built on DINO with the backbone removed §1 §3.2.
  • Every pixel is a token; a six-layer encoder uses deformable attention on the pixel map plus a global token §3.3 §3.4.
  • Training assigns several predictions to each object (one-to-many) and adds noisy boxes for contrastive denoising §3.6 §3.7.
  • Author-reported: SPOD mAP 0.856 versus 0.757 for DINO with Swin-L, and 16.1 M parameters versus 218.3 M tab. 2 tab. 3.
  • Inference is slower than Faster R-CNN, the training data is simulated, and the official code disagrees with the paper on several settings (see Paper vs code).

Problem

Traditional hyperspectral target detection (HTD) classifies each pixel by its similarity to a prior target spectrum, so it returns per-pixel scores rather than objects §1. It cannot use object-level shape and layout, and its methods typically have one class and need only one prior spectrum §3.1 §4.1.

Visual object detectors can return instance-level boxes and classes, but ordinary backbones downsample the image. Point objects that cover a fraction of one pixel are then lost §3.4. DETR-like detectors with one-to-one matching also produce redundant boxes for point objects, which the authors' experiments found §3.5.

Assumptions: the method needs a large set of training images with exact boxes and classes §4.1. The public HTD datasets lack such a training set, so the authors simulate one from a single prior spectrum per class §4.1 [supp. Generation of Simulated Training Data for Public HTD Datasets].

Method

Overview. SpecDETR is built on DINO and removes its backbone. It contains a multi-layer transformer encoder, a multi-layer decoder, and several prediction heads. A linear layer maps the bands of each pixel to a token, and every pixel is one token §3.2 fig. 3. Each encoder output token proposes one candidate box at its pixel location, and the top candidates initialise the decoder queries §3.2 §3.5. The decoder refines the boxes and predicts classes layer by layer. Training adds a denoising branch and replaces the one-to-one matching of DETR with a hybrid one-to-many assigner. Inference keeps the top-scoring predictions and applies non-maximum suppression (NMS) §3.2.

Data tokenisation. A cube X with H × W pixels and N bands is divided by one constant V and passed through a linear layer and layer normalisation. The constant is shared by the whole dataset §3.3 eq. 1. The initial global token is the mean of all pixel tokens §3.3 eq. 2. The authors reject per-band and per-image normalisation because bands differ in spread and images differ in range §3.3.

Encoder with self-S2A. Each encoder layer applies a self-excited subpixel-scale attention module (S2A) with a residual connection and layer normalisation, then a feed-forward network with the same structure §3.4 eq. 3 eq. 4. S2A is deformable attention with two sampled maps. The first is the pixel map at full resolution, sampled at sub-pixel positions by bilinear interpolation §3.4 eq. 8 eq. 10. The second is the global token, which is treated as a one-pixel map so that it can amplify its own features ("self-excitation") §3.4 fig. 6. Offsets and weights come from the query token and its position encoding §3.4 eq. 5 eq. 6. The weights are normalised over the sampling points §3.4. Each head produces a value, and the heads are concatenated and projected §3.4 eq. 9. The authors describe the sampling as a linear mixing model: the sampled spectrum is a non-negative combination of the four nearest pixel spectra §3.4 eq. 11.

Decoder. The first candidate boxes are built from encoder outputs. Each token gives an initial box and class scores §3.5 eq. 12 eq. 13. The top Q_match candidates are kept, and each becomes a decoder query. All content queries start as a vector of ones, with no index embedding, because the authors judge distinct queries unnecessary under one-to-many matching §3.5. Each decoder layer updates the queries with a cross-attention to the encoder output and a feed-forward network §3.5 eq. 14 eq. 15. The authors remove the self-attention between queries, so the queries do not interact §3.5. Each layer then predicts a box update, a detached copy is passed on, and the loss uses a second prediction built from the previous layer's box, which DINO calls "look forward twice" §3.5 eq. 16 eq. 17 eq. 18 eq. 19. The class scores of each query form Q × N_C predictions §3.5.

Hybrid one-to-many assignment. Forced matching first runs the Hungarian algorithm once, so each ground-truth box gets one positive prediction, using a combined GIoU, L1 and classification cost §3.6. Dynamic matching then adds positives from the remaining predictions whose IoU with a ground-truth box is above a threshold. At most T extra positives are kept per ground-truth box, highest IoU first §3.6 [supp. Hybrid Label Assigner of SpecDETR].

Center-shifting contrastive denoising (CCDN). The denoising branch makes noisy copies of ground-truth boxes as positive and negative training queries §3.7. Each copy is shifted from the box centre by a random amount tied to the box size. Positive copies stay near the centre, and negative copies land between half and all of a τ₁ fraction of the size §3.7. The width and height of each copy are then resampled around the original size with a factor τ₂ §3.7. The paper states τ₁ = 0.5 and τ₂ = 1.5 §5.1.1. The original CDN of DINO uses negatives that overlap the positives; the authors say such negatives confuse the classifier of a one-to-many detector §3.7 tab. 12.

Losses and inference. The loss is DINO's: L1 and GIoU for boxes and focal loss for classes, applied to each decoder layer and to the encoder candidates, with weights 5, 2 and 1 [supp. Loss Function]. At test time the top 300 (query, class) scores are kept, then NMS with IoU 0.01 removes overlaps §5.1.1.

Algorithms

Pseudocode is in the authors' notation. Each line is a rewrite in our own words. Each step cites the paper section it follows.

Pseudocode
# Data tokenisation  [§3.3] [eq. 1] [eq. 2]
# cube: (H, W, N) bands; V: one constant for the whole dataset
def tokenize(cube, V):
    # One token per pixel, after linear map and layer norm  [§3.3] [eq. 1]
    pixel_tokens = layer_norm(linear(cube / V))   # (H, W, C)
    # Global token: mean over all pixel tokens  [§3.3] [eq. 2]
    global_token = mean_over_pixels(pixel_tokens) # (C,)
    return pixel_tokens, global_token
Pseudocode
# One encoder layer  [§3.4] [eq. 3] [eq. 4]
# tokens: pixel tokens and the global token, (H*W + 1, C)
def encoder_layer(tokens):
    # Self-S2A with residual, then layer norm  [§3.4] [eq. 3]
    mixed = layer_norm(self_s2a(tokens) + tokens)
    # Feed-forward with residual, then layer norm  [§3.4] [eq. 4]
    return layer_norm(feed_forward(mixed) + mixed)
Pseudocode
# Self-S2A over all encoder tokens  [§3.4] [eq. 5-9]
# M heads, K sampling points per head; pixel map plus global token
def self_s2a(tokens):
    pixel_map, global_map = split_pixel_and_global(tokens)  # [§3.4]
    # Offsets and weights from each token and its position  [§3.4] [eq. 5-6]
    token_input = tokens + position_encoding(tokens)
    offsets = linear(token_input)     # (N, M, K, 2) per pixel and global part
    weights = linear(token_input)     # (N, M, K) per pixel and global part
    # Weights are normalised over the K points  [§3.4]
    weights = weights / sum_over_points(weights)
    # One shared linear layer gives the sampled values  [§3.4] [eq. 7]
    value_pixels, value_global = shared_linear(pixel_map, global_map)
    outputs = []
    for query in tokens:
        head_outputs = []
        for head in range(M):
            # Weighted bilinear samples of both maps  [§3.4] [eq. 8]
            head_outputs.append(sample_and_sum(head, query))
        # Concatenate heads, project, add the query as residual  [§3.4] [eq. 9]
        outputs.append(linear(query + concat(head_outputs)))
    return stack(outputs)
Pseudocode
# Decoder forward  [§3.5] [eq. 12-19]
# encoder_out: encoder tokens; anchors: one per pixel
def decoder_forward(encoder_out, anchors):
    # Candidate box and class scores from each encoder token  [§3.5] [eq. 12-13]
    boxes = sigmoid(box_head_0(encoder_out) + inverse_sigmoid(anchors))
    scores = sigmoid(class_head_0(encoder_out))   # (H*W, C)
    # Keep the top Q_match candidates by their best class score  [§3.5]
    chosen = topk(max_over_classes(scores), Q_match)
    queries = ones(Q_match, C)            # all-one content queries  [§3.5]
    boxes = boxes[chosen]
    # Assumed: b_hat of layer 0 is b_0, not stated  [§3.5]
    previous_hat = boxes
    outputs = []
    for layer in range(D):
        # Cross-attention only, no attention between queries  [§3.5] [eq. 14-15]
        queries = decoder_layer(queries, encoder_out, boxes)
        # Box refinement, layer d  [§3.5] [eq. 16]
        hat = sigmoid(box_head_d(queries) + inverse_sigmoid(boxes))
        # Loss box: uses the previous layer's un-detached box  [§3.5] [eq. 18]
        loss_box = sigmoid(box_head_d(queries) + inverse_sigmoid(previous_hat))
        # Next layer starts from a detached copy  [§3.5] [eq. 17]
        boxes = detach(hat)
        previous_hat = hat
        # Class scores for the loss box  [§3.5] [eq. 19]
        outputs.append((loss_box, sigmoid(class_head_d(queries))))
    return outputs
Pseudocode
# Hybrid one-to-many assignment  [§3.6] [supp. Hybrid Label Assigner]
# gts: (G, 4) boxes; preds: (Q, 4) boxes; cost: (Q, G) forced-matching cost
def hybrid_assign(gts, preds, cost, T, iou_min):
    # Forced matching: one Hungarian pair per ground truth  [§3.6]
    positives = hungarian_pairs(cost)
    for gt in gts:
        # Predictions with IoU above the threshold  [§3.6] [supp. alg.]
        candidates = [p for p in preds if iou(p, gt) > iou_min]
        # Keep at most T of them, highest IoU first  [§3.6] [§5.1.1]
        positives += top_by_iou(candidates, T)
    return positives
Pseudocode
# Centre-shifting contrastive denoising, one ground-truth box  [§3.7]
# box = (x, y, w, h); tau1 = 0.5, tau2 = 1.5  [§5.1.1]
def ccdn_noise(box, is_positive, tau1, tau2):
    x, y, w, h = box
    if is_positive:
        # Centre shift inside +-0.5 * tau1 of the size  [§3.7]
        shift_x = uniform(-0.5 * tau1 * w, 0.5 * tau1 * w)
        shift_y = uniform(-0.5 * tau1 * h, 0.5 * tau1 * h)
    else:
        # Centre shift between 0.5 and 1 times tau1 of the size  [§3.7]
        shift_x = random_sign() * uniform(0.5 * tau1 * w, tau1 * w)
        shift_y = random_sign() * uniform(0.5 * tau1 * h, tau1 * h)
    # Width and height resampled around the size  [§3.7] (see Paper vs code)
    new_w = uniform(min(0, w - tau2 * w), w + tau2 * w)
    new_h = uniform(min(0, h - tau2 * h), h + tau2 * h)
    return (x + shift_x, y + shift_y, new_w, new_h)

Hyperparameters

The paper's own values come first. Where the paper is silent, the official code at the commit above gives a value, which is marked as code. Config paths are relative to the repository root. Values with [supp. ...] come from the supplement, cited by section title because its numbering is not checked against the compiled PDF.

NameValueWhereNotes
Input bands, SPOD30§4.2150 retained bands averaged in groups of 5; code in_channels=30 SpecDETR_SPOD_100e.py
Input bands, Avon / SanDiego / Gulfport360 / 180 / 72§4.3 §4.4 §4.5code: configs/specdetr/SpecDETR_Avon_36e.py#L9, SpecDETR_Sandiego_12e.py#L9, SpecDETR_MUUFLGulfport_24e.py#L9
Normalisation constant V3000 (SPOD), 5000 (Avon), 1 (SanDiego, Gulfport reflectance)§3.3code: configs/base/datasets/hsi_detection.py#L17 (3000); hsi_detection_Avon.py#L19 (5000). Division at mmdet/datasets/transforms/hsi/hsi_load.py#L81. SanDiego and Gulfport constants not checked
Token dimension Cnot stated§3.3code: embed_dims=256 SpecDETR_SPOD_100e.py
Encoder layers6§5.4.2code: configs/specdetr/SpecDETR_SPOD_100e.py#L38
Decoder layers6§5.4.2code: configs/specdetr/SpecDETR_SPOD_100e.py#L48
Attention heads Mnot stated for SpecDETR; §3.4 names 8 as the deformable DETR default§3.4code: not set in the config, so the attention library default applies (not checked in this repo)
Sampling points Knot stated§3.4code: num_points=4 in encoder and cross-attention SpecDETR_SPOD_100e.py SpecDETR_SPOD_100e.py
Feed-forward widthnot stated§3.4code: 8 × C = 2048 SpecDETR_SPOD_100e.py
Position encodingnot stated§3.4code: sine, 128 features per axis, temperature 20 SpecDETR_SPOD_100e.py
Candidate box size snot stated§3.5 eq. 12code: 0.01 in normalised units SpecDETR_SPOD_100e.py
Matching queries Q_matchnot stated§3.5code: 900 SpecDETR_SPOD_100e.py
Denoising pairs200§5.1.1code: num_dn_queries=200 with dynamic groups SpecDETR_SPOD_100e.py; groups = 200 // max targets per batch
τ₁, centre shift0.5§5.1.1code: label_noise_scale=0.5 SpecDETR_SPOD_100e.py
τ₂, box scale1.5§5.1.1code: box_noise_scale=1.5 SpecDETR_SPOD_100e.py
Dynamic IoU threshold0.95§5.1.1code: iou_loss_th=0.05 applied to cost 1 − IoU SpecDETR_SPOD_100e.py match_cost.py
Number threshold T9§5.1.1 §3.6code: match_num=10, which means forced matching plus 9 dynamic rounds SpecDETR_SPOD_100e.py
Forced matching cost weightsfocal 2, L1 5, GIoU 2§3.6SpecDETR_SPOD_100e.py. The supplement algorithm uses unit weights [supp. Hybrid Label Assigner of SpecDETR]
Focal loss α, γnot stated[supp. Loss Function]code: α 0.25, γ 2.0 SpecDETR_SPOD_100e.py
Loss weights, class / L1 / GIoU1 / 5 / 2[supp. Loss Function]matches DINO; code SpecDETR_SPOD_100e.py
OptimiserAdamW, lr 1e-4, weight decay 1e-4 (code)§5.1.1 gives lr 0.001conflict, see Paper vs code. Code: SpecDETR_SPOD_100e.py
Gradient clippingmax-norm 0.1, L2 (code)not statedSpecDETR_SPOD_100e.py
Learning-rate schedule×0.1 at epoch 20, 30 or 90 for 24, 36 or 100 epochs§5.1.1code: milestone 90 in the 100-epoch file SpecDETR_SPOD_100e.py; 24 and 36 epoch files set [20] and [30] SpecDETR_SPOD_24e.py SpecDETR_SPOD_36e.py but inherit a missing file
EpochsSPOD 100 (default), Avon 36, SanDiego 12, Gulfport 24§5.1.1 §5.2SpecDETR_SPOD_100e.py SpecDETR_Avon_36e.py SpecDETR_Sandiego_12e.py SpecDETR_MUUFLGulfport_24e.py
Batch size4§5.1.1[code: configs/base/datasets/hsi_detection.py#L38]
Augmentationrandom horizontal flip, p = 0.5not stated[code: configs/base/datasets/hsi_detection.py#L24]
HardwareRTX 3090§5.1.1
Hybrid cap per imagenot statednot statedcode: total_num_max=100 default dynamic_iou_hungarian_assigner.py
Output captop 300 (query, class) pairs§5.1.1code: max_per_img=300 SpecDETR_SPOD_100e.py, topk specdetr_head.py
NMSIoU 0.01, class-agnostic§5.1.1code: iou_threshold=0.01 SpecDETR_SPOD_100e.py; nms call specdetr_head.py
Box rounding to pixelsAvon rounded (paper); SPOD off§5.1.1code: on for Avon, SanDiego, Gulfport, off for SPOD SpecDETR_Avon_36e.py; SpecDETR_SPOD_100e.py
Visual-baseline input×4 upscaling by pixel replication§5.1.1applies only to the compared visual detectors

Datasets

SPOD (simulated). Built from AVIRIS flight lines over California and Nevada. One flight line gives 150 training background images and another gives 500 test backgrounds, all 128 × 128 §4.2. The paper says 150 bands are kept; the listed band IDs give 151 bands (see Pitfalls). Averaging every 5 adjacent bands leaves 30 bands §4.2. Each image gets between 1 and 20 synthetic objects, and each object is placed with a template that combines endmember spectra from 12 USGS reflectance curves §4.2 tab. 1. Eight object classes are defined, with single, hybrid and combined templates §4.2 tab. 1.

Table 1. Object simulation setup on SPOD §4.2:

NameTypeEndmember componentsObject pixelsMax abundanceTraining samplesTest samples
C1SingleCardboard10.05–0.2122686
C2SingleMalachite10.05–0.2118674
C3SingleFiberglass1–20.2–1136633
C4SingleNickelPowder3–50.2–1120664
C5SingleLutetiumOxide3–50.2–1108688
C6HybridKerogen, NylonWebbing6–100.2–1122669
C7CombinedPlasticSheet, OiledMarshPlant6–100.2–1106686
C8CombinedVerdigris, YtterbiumOxide, WoodBeam11–160.2–1123629

Mixed pixels, those next to background, get an abundance drawn at random and assigned by distance to the object centre §4.2. If every pixel of an object is mixed, the centre pixel gets a value from the maximum-abundance range §4.2. The simulation maps reflectance to radiance by a seawater-based linear scale, with a multiplicative factor M_t in [2000, 3000] and a wide-area fluctuation factor b drawn from [−0.3, 0.3] [supp. Supplements to Implementation Details]. Mixing follows the linear mixing model §4.2 [supp. Supplements to Implementation Details].

Avon (real). A 128 × 128 test crop from one flight, with 24 real objects: 12 blue and 12 brown tarps. Bands are 360, spanning 400 to 2450 nm at 5 nm resolution §4.3. Labels were drawn by hand from two detection maps, then converted to boxes by 8-connected components §4.1 §4.3. The training set is 150 simulated images from another flight, each with 10 blue and 10 brown simulated tarps §4.3. Four other flights of the same area test robustness to lighting §5.3.1.

SanDiego (real). A 128 × 128 crop from a 400 × 400 AVIRIS image of an airport with 3 aircraft, 180 bands, 3.5 m resolution §4.4. Training is 100 simulated images with 10 aircraft each, using one prior spectrum per class §4.4. The test labels come from a mask in the literature §4.4 §4.6.1.

Gulfport (real). Five 128 × 128 test crops from flight 3 of a CASI-1500 sensor, 72 bands between 367.7 and 1043.4 nm, 1 m resolution. There are 57 cloth panels in four colours §4.5. Confidence levels were given by human annotators: visible 9, probably visible 7, possibly visible 8, not visible 33 §4.5. Training uses 200 simulated images with five panels of each type, built from flight 4 §4.5 [supp. Supplements to Implementation Details].

Evaluation. On SPOD and Avon, the COCO protocol gives AP averaged over IoU 0.5–0.95, mAR, and AP at IoU 0.25 (mAP25, mRe25). Each image keeps the top 100 predictions §4.6.1. For SanDiego a prediction is correct if its IoU with the box is above 0.25. For Gulfport the correct area is a 5 × 5 inner box and a 9 × 9 outer box around the GPS point §4.6.1. For HTD methods, normalised score maps are cut at the threshold that maximises IoU, chosen per class with steps of 0.01, and then converted to boxes §4.6.2. The paper also reports mAUC and mIoU for them §4.6.2.

Results

Author-reported. Setup: the simulated SPOD benchmark at native 128 × 128, 30 bands, 100 epochs, batch 4 on an RTX 3090 §5.1.1. Visual detectors receive the cube upsampled ×4 by pixel replication §5.1.1.

Visual detectors on SPOD tab. 2

DetectorBackboneEpochsSizemAPmAP25mARmRe25AP C1AP C2AP C3AP C4AP C5AP C6AP C7AP C8
Faster R-CNNResNet50100×40.1970.3770.2450.4190.0000.0000.0000.0350.0260.5370.4300.550
Faster R-CNNRegNetX100×40.2270.3790.2670.3990.0000.0000.0000.0420.0430.6310.5220.578
Faster R-CNNResNeSt50100×40.2460.3160.2690.3190.0000.0000.0000.0080.0030.6440.5640.747
Faster R-CNNResNeXt101100×40.2200.3680.2530.3760.0000.0000.0000.0160.0100.6180.5180.596
Faster R-CNNHRNet100×40.3200.4040.3640.4340.0000.0000.0000.1070.0760.8490.7310.793
TOODResNeXt101100×40.3040.4640.4010.5700.0000.0000.0000.1810.1940.7430.6480.663
CentripetalNetHourglassNet104100×40.6950.8290.8400.9560.8310.8880.9150.3730.3670.8100.6550.725
CornerNetHourglassNet104100×40.6260.7360.8550.9690.7970.7510.8550.3280.3080.7680.5540.644
RepPointsResNet50100×40.2070.6910.3460.9340.0430.1430.2690.0710.0730.3720.2650.417
RepPointsResNeXt101100×40.4850.8060.6350.9610.3730.5610.6320.2420.2530.6580.5080.649
RetinaNetEfficientNet100×40.4620.8360.6110.9710.5660.6020.5300.1820.2100.5660.4710.569
RetinaNetPVTv2-B3100×40.4260.7570.6500.9870.3560.4780.4580.2090.2320.5630.4700.644
DeformableDETRResNet50100×40.2310.6920.3850.8830.2300.3160.2340.0770.0700.2890.2380.395
DINOResNet50100×40.1680.4910.3680.7630.0200.0470.2770.0800.0640.2860.2130.360
DINOSwin-L100×40.7570.8520.9090.9830.9150.9120.9510.4830.4970.8470.7280.721
SpecDETR-100×10.8560.9380.8970.9550.9630.9690.9700.6980.6480.9050.8440.850

Among these rows, SpecDETR has the highest mAP, mAP25 and per-class AP for all eight classes. DINO with Swin-L has the highest mAR and mRe25 tab. 2.

Computational cost tab. 3

DetectorBackboneImage sizeTraining time (min)Inference (FPS)FLOPs (G)Params (M)GPU memory (MB)
Faster R-CNNResNet50×48.840.368.841.5309
Faster R-CNNRegNetX×49.033.257.731.6270
Faster R-CNNResNeSt50×412.823.9185.144.6467
Faster R-CNNResNeXt101×414.626.3128.499.4528
Faster R-CNNHRNet×413.917.4104.463.2407
TOODResNeXt101×417.311.2114.397.7485
CentripetalNetHourglassNet104×430.214.7501.3205.91098
CornerNetHourglassNet104×425.016.3462.6201.1981
RepPointsResNet50×410.433.754.136.9238
RepPointsResNeXt101×417.614.775.058.1329
RetinaNetEfficientNet×49.030.536.118.5215
RetinaNetPVTv2-B3×413.422.371.352.4313
DeformableDETRResNet50×413.824.658.741.2252
DINOResNet50×417.321.386.347.6301
DINOSwin-L×453.810.1203.9218.31168
SpecDETR-×117.824.7139.716.1287

HTD methods on SPOD tab. 4

MethodmAUCmIoUmAPmAP25mARmRe25AP C1AP C2AP C3AP C4AP C5AP C6AP C7AP C8
ASD0.9910.3590.1820.2860.7120.9390.0610.0680.5870.0780.0650.2980.1010.194
CEM0.9810.1660.0400.1220.2620.6720.0110.0620.2150.0090.0050.0080.0100.002
OSP0.9690.1590.0310.1080.2020.5940.0080.0390.1810.0020.0020.0060.0090.000
KOSP0.9610.1160.0170.0830.1650.5390.0000.0020.1190.0020.0020.0090.0010.002
SMF0.9040.0390.0030.0160.0780.3010.0000.0000.0200.0000.0000.0000.0000.000
KSMF0.8910.0410.0030.0150.0590.2060.0000.0000.0240.0000.0000.0000.0000.000
TCIMF0.9750.0960.0090.0610.1600.5470.0040.0010.0520.0030.0010.0040.0050.003
CR0.9390.1600.0310.1380.2420.6850.0080.0000.1600.0170.0150.0160.0200.012
KSR0.8770.1400.0150.0910.1330.5300.0080.0010.0940.0020.0030.0060.0040.001
KSRBBH0.7850.1440.0070.0870.1050.4660.0000.0000.0000.0070.0070.0280.0080.010
LSSA0.7020.1190.0410.0930.1630.3020.0010.0020.2720.0010.0000.0510.0000.000
IRN0.6250.0040.0000.0020.0050.0330.0000.0000.0000.0000.0000.0000.0000.000
TSTTD0.9640.0560.0440.0570.7450.9180.0050.0220.2070.0170.0180.0200.0130.049
SpecDETR--0.8560.9380.8970.9550.9630.9690.9700.6980.6480.9050.8440.850

The HTD rows are the adapted baselines of §5.1.1. Most HTD methods take prior spectra and need no training. LSSA was changed to output all classes at once, and IRN and TSTTD were trained on the training images §5.1.1 [supp. Experimental Setup for Compared HTD Methods]. mAUC is a pixel-level score, and it does not track the object-level columns (mAP, mAP25).

Avon tab. 5

MethodmAUCmIoUmAPmAP25mARmRe25AP BLAP BR
ASD0.9610.6540.3240.8530.5381.0000.3120.336
CEM0.9670.4600.1780.5660.4711.0000.2180.139
OSP0.9670.4570.1640.5260.4711.0000.2020.126
KOSP0.9770.3740.1110.3800.4540.9580.1320.090
SMF0.9570.1550.0470.2400.3500.9580.0020.092
KSMF0.9650.2110.0680.2290.4630.9580.0640.073
TCIMF0.9820.4330.1810.4560.5381.0000.2200.142
CR0.8060.3130.0130.5510.0460.8750.0230.002
KSR0.9440.2690.0030.3290.0080.7500.0040.001
KSRBBH0.8680.4950.1810.5780.4831.0000.1480.213
LSSA0.9230.3880.0970.4070.2920.8330.1870.008
IRN0.7500.3910.3020.5000.3670.5000.6050.000
TSTTD0.9510.4630.3120.5700.5791.0000.5600.065
SpecDETR--0.8850.9900.9251.0000.9240.847

The Avon test set is a single image. Validating SpecDETR on the simulated Avon training images gives 0.979 mAP and 0.998 mAP25, against 0.885 and 0.990 on the real test image [supp. Generalization Analysis]. The gap is the only held-out evidence the paper gives for Avon.

SanDiego and Gulfport tab. 6

MethodSanDiego APSanDiego ReGulfport mean APGulfport mean ReB. APB. ReD.G. APD.G. ReP.G. APP.G. ReF.V.G. APF.V.G. Re
CentripetalNet0.7761.0000.1780.2130.2080.2000.1920.2670.1390.1330.1710.250
CornerNet0.7501.0000.1600.2710.2030.2670.0690.1330.2420.2670.1250.417
DINO0.2101.0000.1740.4080.2200.3330.2320.4000.1660.4000.0770.500
SpecDETR1.0001.0000.2130.3210.2770.3330.1910.2000.2180.3330.1670.417

B., D.G., P.G. and F.V.G. are brown, dark green, pea green and faux vineyard green panels tab. 6. The training epochs are 12 for SanDiego and 24 for Gulfport, with the learning rate reduced at epoch 10 and 20 respectively §5.2.

Gulfport detections under fixed confidence thresholds, SpecDETR only tab. 7:

ConfidenceNum.TPPrReVis TPVis RePro.Vis TPPro.Vis RePos.Vis TPPos.Vis ReNotVis TPNotVis Re
0380180.0470.31691.00040.57130.37520.061
0.0597150.1550.26391.00040.57110.12510.030
0.152150.2890.26391.00040.57110.12510.030
0.226130.5000.22880.88940.57110.12500.000
0.317120.7060.21170.77840.57110.12500.000
0.41390.6920.15860.66730.42900.00000.000
0.5960.6670.10540.44420.28600.00000.000

Num. is the number of predictions after confidence filtering, and TP is the number of true positives. Pr is TP divided by Num., and Re is TP divided by the 57 panels tab. 7.

Robustness on Avon tab. 8, tab. 9

Lighting. Four other flights of the same area, imaged at different times §5.3.1:

Imaging timemAP25mRe25Blue AP25Blue Re25Brown AP25Brown Re25
12:010.9901.0001.0001.0000.9811.000
12:060.9741.0001.0001.0000.9491.000
13:440.9811.0001.0001.0000.9621.000
13:510.9871.0001.0001.0000.9741.000
13:571.0001.0001.0001.0001.0001.000

Additive Gaussian white noise on the test image, with no retraining. The noise level is defined by the per-band signal-to-noise ratio §5.3.2:

Noise levelmAP25mRe25Blue AP25Blue Re25Brown AP25Brown Re25
SNR 10 dB0.2550.4580.4770.5830.0320.333
SNR 15 dB0.4160.7080.7520.7500.0790.667
SNR 20 dB0.5200.8330.9110.9170.1280.750
SNR 25 dB0.4810.9170.8420.9170.1200.917
SNR 30 dB0.6140.9581.0001.0000.2270.917
SNR 35 dB0.7611.0001.0001.0000.5231.000
no noise0.9901.0001.0001.0000.9811.000

Ablations on SPOD tab. 10 to tab. 14

Module combinations tab. 10:

Image sizeBackboneEncoderDecodermAP 24 ep.mAP 36 ep.mAP 100 ep.FLOPs (G)Params (M)
×4Swin-LDINODINO0.3910.6050.757203.9218.3
×1-SpecDETRDINO0.6630.7590.849143.617.9
×1-SpecDETRSpecDETR0.7060.7990.856139.716.1

Encoder and decoder depth, at 36 epochs tab. 11:

Encoder layersDecoder layersmAPFLOPs (G)Params (M)
220.47048.95.7
240.57754.08.4
260.57959.011.2
420.62889.28.2
440.70394.310.9
460.73799.413.6
620.704129.610.6
640.750134.713.4
660.799139.716.1

Assignment and denoising, mAP at 36 and 100 epochs tab. 12:

DenoisingAssignmentmAP 36 ep.mAP 100 ep.
noneforced matching0.6110.796
noneforced + dynamic0.5950.800
DNforced matching0.7730.836
DNforced + dynamic0.7850.844
CDNforced matching0.7560.822
CDNforced + dynamic0.7910.846
CCDNforced matching0.7800.829
CCDNforced + dynamic0.7990.856

S2A variants tab. 13. In the second row, the structure exists but does not do its job:

Self-excited operatorDeformable samplingmAP 24 ep.mAP 36 ep.mAP 100 ep.
offon0.2280.5400.804
structure present, inactiveoff0.6520.7480.842
onon0.7060.7990.856

Content query initialisation tab. 14:

Content queryAP 24 ep.AP 36 ep.AP 100 ep.
Embedding0.6470.7710.845
Random0.6120.7900.855
Constant (all ones)0.7060.7990.856

The supplement also tests generalisation on SPOD. Training on the 100 training images and testing on the 500 test images gives mAP 0.856; training on the test images and validating on the training images gives 0.922 [supp. Generalization Analysis]. In a single-class comparison with sparse-representation HTD methods, SpecDETR reaches AP 0.907 and AP25 0.989. The best sparse baseline, KSRBBH, reaches AP 0.073 and AP25 0.341 [supp. Sparse Representation-Based HTD Methods].

Paper vs code

Official repository: https://github.com/ZhaoxuLi123/SpecDETR at commit 5a13a63c7274422c9b30f7e82ac6e5d22fe83d4c, Apache-2.0. The abstract links this repository, so it is treated as the official code. The code is an mmdet fork, and its head docstring says it is modified from DINO specdetr_head.py.

Differences (paper first, then code):

  • Learning rate. Paper: initial 0.001, "consistent with DINO" §5.1.1. Code: AdamW at 0.0001 in every dataset config SpecDETR_SPOD_100e.py SpecDETR_Avon_36e.py.
  • Centre-shift and box-scale noise. Centre shifts match the paper: ±0.25 w for positives with τ₁ = 0.5 §3.7 specdetr_layers.py specdetr_layers.py. Box scaling does not: the paper gives width in [min(0, w − τ₂w), w + τ₂w] §3.7, but the code adds uniform noise on [−τ₂, τ₂] times w/2, so width moves by at most 0.75 w specdetr_layers.py.
  • Global token. Paper: g₀ is the mean of the pixel tokens §3.3 eq. 2. Code: a second 1 × 1 map is built as the spatial mean of the first feature map and detached from the graph st_nobackbone.py. The gradient of the global token therefore does not flow back to the input projection through this path.
  • Dynamic matching. Paper: for each ground-truth box, take the top-T predictions by IoU among those above the threshold §3.6 [supp. Hybrid Label Assigner]. Code: repeated Hungarian matching on the cost 1 − IoU, masking matched predictions each round, stopping early if a round finds nothing above the threshold dynamic_iou_hungarian_assigner.py. The code also caps all matches per image at 100 dynamic_iou_hungarian_assigner.py dynamic_iou_hungarian_assigner.py.
  • Forced-matching weights. Paper's supplement algorithm sums the three costs with unit weights [supp. Hybrid Label Assigner]. Code weights them 2 (focal), 5 (L1) and 2 (GIoU) SpecDETR_SPOD_100e.py.
  • Number threshold. Paper: T = 9 dynamic positives §5.1.1. Code: match_num=10, which means forced matching plus nine dynamic rounds SpecDETR_SPOD_100e.py. The two agree only if the forced match is not counted.
  • Look-forward-twice. Paper: Eq. 16–18 §3.5. Code: no un-commented detach on the box update was found in the active head SpecDetrHead specdetr_head.py. The detector detaches only the top-k coordinates specdetr.py. Not confirmed; verify before relying on it.
  • Top-Q selection. Paper: "highest confidences" §3.5, without saying how to reduce the class vector. Code: the maximum over classes is used specdetr.py.
  • Query self-attention. Paper: removed §3.5. Code: removed; the self-attention lines are commented out specdetr_layers.py specdetr_layers.py. Matches.
  • Denoising pairs. Paper: 200 pairs §5.1.1. Code: num_dn_queries=200 divided by the maximum number of targets in the batch, which gives about 200 pairs per batch SpecDETR_SPOD_100e.py specdetr_layers.py. Matches in spirit.
  • Random flip. Paper: not mentioned. Code: horizontal flip with probability 0.5 in the training pipeline [code: configs/base/datasets/hsi_detection.py#L24].
  • NMS. Paper: IoU 0.01 §5.1.1. Code: the same threshold, class-agnostic by default specdetr_head.py. NMS runs only when use_nms=True; the base class default is False detr_head.py. All dataset configs set it SpecDETR_SPOD_100e.py.
  • Normalisation. Paper: V = 3000 (SPOD), 5000 (Avon) §3.3. Code: the same constants [code: configs/base/datasets/hsi_detection.py#L17] [code: configs/base/datasets/hsi_detection_Avon.py#L19], applied by division hsi_load.py.
  • Rounding. Paper: Avon boxes are rounded to integers §5.1.1. Code: rounding is on for Avon, SanDiego and Gulfport and off for SPOD SpecDETR_Avon_36e.py SpecDETR_SPOD_100e.py.
  • Epochs and milestones. Paper: 100 / 36 / 12 / 24 epochs §5.1.1 §5.2. Code matches SpecDETR_SPOD_100e.py SpecDETR_Avon_36e.py SpecDETR_Sandiego_12e.py SpecDETR_MUUFLGulfport_24e.py.
  • Encoder depth. Paper: six layers §5.4.2. Code: six SpecDETR_SPOD_100e.py.
  • Band counts. Paper: 30 SPOD, 360 Avon, 180 SanDiego, 72 Gulfport §4.2-§4.5. Code matches SpecDETR_SPOD_100e.py.
  • Simulator. The SPOD simulator and the dataset generator are not in the repository. Searching the Python sources for endmember, USGS and simulation terms found nothing relevant. The training data path is hard-coded to a local directory [code: configs/base/datasets/hsi_detection.py#L3].
  • Inherited files. The 24- and 36-epoch SPOD configs inherit specdetr_sb-2s-100e_hsi.py SpecDETR_SPOD_24e.py SpecDETR_SPOD_36e.py, which is not in the repository. They cannot be loaded as shipped.
  • Self-excited initialisation. Paper: 2k × 2k square offsets, with the first sample of head k inside the active region §3.4. The code uses the attention library's default initialisation, which was not checked here.

Pitfalls

Internal contradictions in the paper. Where the paper's tables and text disagree, use the tables.

  • The SanDiego text gives 0.750 for CentripetalNet and 0.776 for CornerNet. Table 6 gives the reverse tab. 6.
  • The text attributes 0.626 mAP to CentripetalNet and 0.691 to CornerNet. Table 2 gives 0.695 for CentripetalNet and 0.626 for CornerNet tab. 2 §5.1.2.
  • The text says the decoder change cuts parameters by 10.6%. From Table 10, 17.9 M to 16.1 M is about 10.1% tab. 10 §5.4.1.
  • The band IDs listed in §4.2 cover 151 bands, not 150. Averaging groups of 5 only gives 30 bands from 150 §4.2.
  • The mixed-pixel abundance range in §4.2 is 0.01–1, but the supplement gives 0.1–1 for Avon §4.2 [supp. Generation of Simulated Training Data].
  • The Gulfport maximum-abundance range is 0.3–1 in the supplement text and 0.7–1 in its table [supp. Generation of Simulated Training Data] [supp. parameter table].
  • The SPOD training background set has 150 images in §4.2 but 100 in the supplement's generalisation study §4.2 [supp. Generalization Analysis].
  • The lighting text says "mRe25 of 1.0 and above 0.97"; Table 8 has mRe25 = 1.000 everywhere, while 0.974–1.000 is the mAP25 range §5.3.1 tab. 8.
  • The Gulfport text prints "Re of 0.26.3", which is a typo for 0.263 §5.2 tab. 7.
  • Table and figure numbers here follow the TeX order and are not checked against the compiled PDF tab. 2 fig. 3 fig. 6.

Hidden costs and fragile steps.

  • Top-Q selection is ambiguous in the paper and clear only in the code (maximum over classes) §3.5 specdetr.py.
  • The first decoder layer needs the box before refinement, b̂₀. The paper never defines b̂₀; the card takes it as b₀ §3.5 eq. 18.
  • The supplement's assigner does not exclude predictions already matched in forced matching or matched to another ground truth, so one prediction can become positive for two boxes. The code masks matched rows instead (see Paper vs code) [supp. Hybrid Label Assigner of SpecDETR].
  • The paper's width range is literal. With τ₂ = 1.5, min(0, w − τ₂w) = −0.5w, which is negative for any w > 0, so a literal implementation can draw negative widths §3.7. The code does not use this range (see Paper vs code). It clamps the corners to [0, 1] specdetr_layers.py, which can still give zero-width boxes.
  • The number of denoising pairs follows from the largest number of objects in the batch. A batch with a few large objects gets more groups than the paper's 200 suggests specdetr_layers.py.
  • NMS is applied after keeping the top 300 (query, class) pairs, so the final count can be well below 300 specdetr_head.py specdetr_head.py.
  • Full resolution means many tokens. The encoder runs over H × W tokens, and FLOPs grow almost linearly with encoder depth §5.4.2 tab. 11.
  • Speed is the weak point. SpecDETR runs at 24.7 FPS, against 40.3 FPS for Faster R-CNN with ResNet50, and 139.7 GFLOPs against 68.8 tab. 3 §5.1.2.

Evaluation caveats.

  • The HTD baselines get a per-class threshold chosen on the test labels to maximise IoU §4.6.2. That makes the HTD numbers optimistic. In the supplement, ASD's mAP changes strongly with the number of pixels kept per object [supp. Discussion on the Conversion of Detection Score Maps].
  • The SanDiego and Gulfport predictions have low confidence, mostly below 0.5, which the authors attribute to the gap between simulated training and real test images §5.2. Gulfport recall depends strongly on the confidence cut-off tab. 7.
  • Avon's test set is one image with 24 objects, so small differences between methods say little §4.3.
  • Visual baselines run at ×4 input and SpecDETR at ×1, so the FLOPs and FPS columns compare different input sizes §5.1.1 tab. 3.
  • Robustness results use Gaussian noise added to the test image only, with no retraining §5.3.2.
  • Every result is author-reported. The tables give single values without error bars.

Reproduction gaps. The official code can train SpecDETR on the SPOD training set only after a simulator is written. The 24- and 36-epoch SPOD configs need the missing base file. For the learning rate, use the code's 1e-4 unless the authors confirm the paper's 1e-3.

Lineage

  • Builds on: DETR for set prediction and Hungarian matching §3.6. DINO (arXiv:2203.03605, no card yet) for the decoder, two-stage design, look-forward-twice and contrastive denoising; SpecDETR keeps these and removes the backbone §3.2 §3.5 specdetr_head.py. Deformable DETR, cited for deformable attention and its eight-head default §3.4. DN-DETR's centre-shift queries, which CCDN adapts §3.7.
  • Compared against: visual detectors Faster R-CNN, TOOD, CentripetalNet, CornerNet, RepPoints, RetinaNet, Deformable DETR and DINO §5.1.1 tab. 2 tab. 3. HTD methods ASD, CEM, OSP, KOSP, SMF, KSMF, TCIMF, CR, KSR, KSRBBH, LSSA, IRN and TSTTD §5.1.1 tab. 4 tab. 5. Also DN, CDN and different assignment rules in ablation tab. 12.
  • Superseded by: not known from the content of this wiki.

Source and license

Adapted from “SpecDETR: A transformer-based hyperspectral point object detection network” by Zhaoxu Li, Wei An, Gaowei Guo, Longguang Wang, Yingqian Wang, Zaiping Lin (arXiv:2405.10148), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/ZhaoxuLi123/SpecDETR at commit 5a13a63c7274 (Apache-2.0). Any quoted code is shown under that license.