---
kind: concept
slug: reverse-attention
title: Reverse attention
summary: >-
  Reverse attention turns a coarser prediction into 1 minus its sigmoid, a map of what that prediction has not yet explained, and uses it to guide the next refinement. Used in camouflaged object detection, either as one reverse step on a fixation map or as a coarse-to-fine cascade of group-reversal blocks. The gain in SINet-V2's own ablation is small (CAMO S-measure 0.814 without it, 0.820 with it).
tags: [attention, segmentation, camouflaged-object-detection, refinement]
papers: ["2102.10274", "2103.04011", "2204.07756"]
related: [salient-object-detection, attention-mechanism, multi-scale-feature-fusion, segmentation-evaluation, multi-task-learning]
status: draft
updated_at: 2026-10-19
---

## Overview

Reverse attention takes a prediction that is already partly right, such as a
coarse mask or a fixation map, and flips it. Where the prediction is confident
the flipped map is near zero. Where it is missing the object, the flipped map
is high. Multiplying features by this map, or adding it as guidance, pushes the
network to look at the parts the prediction has not covered [arxiv:2102.10274
§4.3] [arxiv:2103.04011 §3.2].

The shared step is the reversal, 1 − sigmoid(prediction). The variants differ
in how often the reversal is applied, which feature it guides, and whether the
guidance is accumulated across stages. The survey that classifies attention
methods puts reverse attention under "arithmetic" scores, which are built from
simple operations on other scores or features, such as reversing [arxiv:2204.07756
§2.1.4].

## Variants

### One reverse step on a fixation map

Lv et al. predict a fixation map F that marks the region which makes a
camouflaged object visible. They take 1 − F as a reverse attention and multiply
it with a backbone feature before the mask decoder, so the mask branch works on
the regions the fixation branch did not select [arxiv:2103.04011 §3.2].
The method is trained jointly with a fixation loss and a segmentation loss,
with weight λ = 1 [arxiv:2103.04011 §3.2]. Card: [Simultaneously Localize,
Segment and Rank the Camouflaged Objects](/papers/2103.04011).

### Iterated reverse guidance in a coarse-to-fine cascade

Fan et al. build SINet-V2 with a neighbor connection decoder that makes a
coarse map C6, then three stages that refine it. At each stage the coarser map
is resampled to that level, passed through a sigmoid and reversed. The reversed
map guides a group-reversal attention (GRA) block [arxiv:2102.10274 §4.3]
[eq. 2]. Each stage has three GRA blocks with channel group sizes 32, 8 and 1
[arxiv:2102.10274 §4.3] [§5.3]. The network outputs four maps and supervises all
of them with a weighted IoU and BCE loss, with no extra labels beyond the
masks [arxiv:2102.10274 §4.4.1]. Card: [Concealed Object Detection](/papers/2102.10274).

### Arithmetic form in the survey

The survey lists reverse attention among arithmetic score methods and writes a
different formula for it: a sigmoid of 1 divided by (ReLU of the convolution
output plus 0.125), minus 4. It says the constants are for convergence and
gives no further reason [arxiv:2204.07756 §2.1.4]. This is not the 1 − sigmoid
form used by the two method papers above.

## When to use which

| Situation | Use | Why |
|---|---|---|
| You have only object masks and want no extra labels | Iterated GRA cascade | It is trained with mask losses alone on four maps [arxiv:2102.10274 §4.4.1]. Cost is higher: three blocks per stage [arxiv:2102.10274 §4.3]. Reported speed is about 45 fps at 352×352 on one GPU, excluding I/O [arxiv:2102.10274 §4.4.2]. |
| You can collect a fixation-style map per image | One reverse step on a fixation map | The fixation map is the source of the reverse attention [arxiv:2103.04011 §3.2]. Building it needs eye-tracker data, which the authors recorded from six observers per image [arxiv:2103.04011 §3.1]. |
| You want to add reverse guidance to an existing model with little change | One reverse step, first block only | The paper's ablation reverses only the first block and reports that this works best [arxiv:2102.10274 §5.3]. Reversing all three blocks gives lower scores than the first block alone (COD10K F-measure 0.670 vs 0.680) [arxiv:2102.10274 tab. 6]. |
| You expect a large gain from reversing | Check first | In SINet-V2's ablation, removing reverse guidance costs little: CAMO S-measure 0.814 vs 0.820, and on COD10K F-measure the row without reverse is slightly higher (0.682 vs 0.680) [arxiv:2102.10274 tab. 6]. The table gives one number per cell with no spread across runs [arxiv:2102.10274 tab. 6]. |
| Following the survey's formula | Do not use it as the default | Its constants are given "for convergence" with no reason [arxiv:2204.07756 §2.1.4]. The two method papers use 1 − sigmoid [arxiv:2103.04011 §3.2] [arxiv:2102.10274 §4.3]. |

## Implementation sketch

Two forms, in the common notation. Both use the reversal and differ in where
it is applied.

```pseudocode
# Single reverse step on a backbone feature  [arxiv:2103.04011 §3.2]
# feature: (B, C, h, w); fixation_logits: (B, 1, h, w)

def guide_once(feature, fixation_logits):
    # Reverse the fixation map: 1 - F  [arxiv:2103.04011 §3.2]
    reverse = 1 - sigmoid(fixation_logits)
    # Multiply the reversed map with the feature  [arxiv:2103.04011 §3.2]
    return feature * reverse
```

```pseudocode
# One reverse-guided refinement stage  [arxiv:2102.10274 §4.3] [eq. 2]
# feature: (B, C, h, w); coarse_logits: (B, 1, h, w) from the stage above

def refine_stage(feature, coarse_logits):
    # Resample the coarser map to this resolution  [arxiv:2102.10274 §4.3]
    guide = resample(coarse_logits, feature)
    # Reverse once: 1 - sigmoid  [arxiv:2102.10274 §4.3] [eq. 2]
    reverse = 1 - sigmoid(guide)
    # Group-reversal blocks with group sizes 32, 8, 1  [arxiv:2102.10274 §4.3]
    for group_size in [32, 8, 1]:
        # Mix the reversed map into channel groups  [arxiv:2102.10274 §4.3]
        feature = feature + block(feature, reverse, group_size)
    return feature
```

The second sketch reverses once and reuses that map in every block, as the
paper defines it. The released code accumulates the guidance across blocks
instead (see Contradictions). The sketches omit the residual head and the loss.

## Contradictions

- **Operation.** The survey gives a sigmoid of 1 over (ReLU of the convolution
  plus 0.125), minus 4 [arxiv:2204.07756 §2.1.4]. The two method papers use
  1 − sigmoid of the coarser or fixation map [arxiv:2103.04011 §3.2]
  [arxiv:2102.10274 §4.3] [eq. 2]. These are different functions under the same
  name.
- **Which feature is guided.** The paper says the reversed fixation map is
  multiplied with the first backbone feature s1 [arxiv:2103.04011 §3.2]. The
  card for that paper records that the released code guides the stage-2 feature
  with a maximum of a smoothed and a raw reversed map, so the paper's wording
  does not match the code. See [its Paper vs code section](/papers/2103.04011).
- **Accumulation across blocks.** The paper defines the guidance of block i+1
  as the first reversed map plus a group term, so every block uses the same
  reversed map [arxiv:2102.10274 §4.3] [eq. 3] [eq. 5]. The released code
  updates the guidance in place, so each block sees the previous block's
  output. The card for that paper records this under Paper vs code.
- **Size of the gain.** The authors report the reverse-guidance ablation as
  improving CAMO scores [arxiv:2102.10274 §5.3] [tab. 6]. On COD10K, the row
  without reverse has a slightly higher F-measure than the full model
  [arxiv:2102.10274 tab. 6]. Neither paper reports significance testing.

## Papers

- [Simultaneously Localize, Segment and Rank the Camouflaged Objects](/papers/2103.04011): one reverse step on a fixation map, feeding a mask branch.
- [Concealed Object Detection](/papers/2102.10274): SINet-V2, a coarse-to-fine cascade with reverse guidance and GRA blocks.
- [Visual Attention Methods in Deep Learning: An In-Depth Survey](/papers/2204.07756): classifies reverse attention as an arithmetic attention score.
