Register gap · webcam captions · SigLIP2

A camera's own words

Two small linear maps, trained on a few thousand (caption, frame) pairs of one camera, teach a frozen image-text model the words of that camera.

0.38 → 0.72AUC of the bear cam word begging on 16 new days (0.5 is chance).
0.12 → 0.42R@10 on the Duluth harbor cam, 742 test frames from 2012 to 2026.
0.06 → 0.23R@10 on the Roatán coral cam, 983 test frames.

How it works

A frozen image-text model learned its English from the web. A camera has its own words: bear codes, ship names, the names of places. We do not change the model. We add one linear map for text and one for images, and we train only the two maps on the camera's own (caption, frame) pairs.

Caption"BF 903" Frame(snapshot) Text encoderfrozen Image encoderfrozen Text maplinear, trained Image maplinear, trained shared space words ↔ patches new days, new frames

This is the full method. Each map is a residual linear layer that starts at zero, so the maps start as the frozen encoder. The maps are a small linear adapter on frozen embeddings, in the family of CLIP-Adapter. They are not a new kind of model.

class TwoMaps(torch.nn.Module):
    """phi(x) = normalize(x + W x + b). W and b start at zero, so training starts at the frozen encoder."""

    def __init__(self, dim):
        super().__init__()
        self.text_map = torch.nn.Linear(dim, dim)
        self.image_map = torch.nn.Linear(dim, dim)
        for layer in (self.text_map, self.image_map):
            torch.nn.init.zeros_(layer.weight)
            torch.nn.init.zeros_(layer.bias)

    def text(self, x):
        return torch.nn.functional.normalize(x + self.text_map(x), dim=-1)

    def image(self, x):
        return torch.nn.functional.normalize(x + self.image_map(x), dim=-1)


def contrastive_loss(text, image, temperature=0.05):
    """text, image: (batch, dim). Row i of text matches row i of image."""
    logits = text @ image.T / temperature
    target = torch.arange(len(text), device=text.device)
    return 0.5 * (torch.nn.functional.cross_entropy(logits, target) + torch.nn.functional.cross_entropy(logits.T, target))

Recipe: AdamW, learning rate 1e-4, weight decay 1e-4, batch 128, 30 epochs. After each epoch, we measure R@10 on the validation pairs and keep the best epoch. We split the pairs by day, never at random. Frames from one day look alike, so a random split puts near copies of the test frames in the training data.

Brooks Falls bear cam · Katmai, Alaska · explore.org

How viewers write

Viewers take a snapshot of the live camera and write a short caption. They use a short form of their own: a register. The model learned its English from the web, and the web does not use these words in this way.

BF

The camera tag: Brooks Falls.

903806s

Bear codes from the park. "806s" is a young bear of bear 806.

GullyChunk

Nicknames. Gully is bear 903. Chunk is bear 32.

the officethe lipthe C

Places at the falls.

begging

A bear stays near a bear that has a fish.

high-grading

A bear eats only the best parts of a salmon.

snorkeling

A bear puts its face in the water to look for fish. The four frames below show it.

Where does a bear code point?

Each frame below has one bear, and a viewer named that bear. We ask the model which part of the frame matches the code or the nickname. The frames are a random sample of held-out frames.

The heat shows how well each of the 256 patches matches the query. These images smooth the heat over 3 × 3 patches. The green circle is the hottest point, and the cyan box is the bear.

We trained these maps with a set score, which matches each word of a caption to its best patch. We also tested 355 held-out frames with one bear, and this test does not smooth the heat. The hottest patch is on the bear in 18% of these frames before the maps and in 79% after (chance 31%). Maps trained only on full frames do not point: 18% to 19%.

Find frames by a viewer's word

Choose a word. The model ranks the frames of 16 days that the maps did not train on. A green border shows that a viewer used the word, or a word of the same family, for that frame.

All 13 action words

The maps help most with words of the bear cam, such as "begging" and "sparring". Plain words, such as "sleeping", work well already. Some words lose a little, such as "playing" and "shaking". AUC 0.5 is chance.

Before the mapsAfter the maps
Utopia Village · Roatán, Honduras · explore.org

Reef cams

Two fixed underwater cameras watch a reef. Viewers caption what they see, often with the name of a fish. A live search page answers your phrase in three ways. It uses the frozen model, the two maps, and the two maps over sets of phrases and patches.

Camera (held-out frames)FrozenTwo mapsTwo maps over sets
Coral cam (983)0.06 / 0.180.23 / 0.490.24 / 0.53
Dock cam (954)0.05 / 0.190.26 / 0.590.29 / 0.60

R@10 / R@50, with the caption of each held-out frame as the query. These are the models of the live page.

Open the live reef search
Duluth Harbor Cam · Lake Superior · LSMMA

Duluth harbor, 2012 to 2026

For 14 years, the Duluth Harbor Cam blog posted one or two sentences for each ship that came or went. An example: "Polstream Dabie arrived in Duluth this morning to load grain." Each post has a frame from a harbor camera. The posts are a ship log of the harbor. We use 5,077 posts and their frames from a public repository.

We use full captions as queries on 742 test frames. R@10 is . The two maps are better for full captions.

The set maps are the same two maps, trained with the set score of part 5 of the notebook. They are better for single words: .

Caution: names on the screen. Many frames carry the ship name as text on the image. In 60 random frames, we counted 18 (about 1 in 3) with the name as an overlay. The maps can learn to read this text. The set maps can match a ship name to the patch that shows it. Part of their gain on ship names can come from the overlay. Thus we test ship names apart from cargo and place words, which the overlay does not show.

The top 5 of 742 test frames. A green border shows that the post uses the word. A red border does not always show an error: a frame can show a coal ship whose post does not say "coal". AUC counts the full order of the 742 frames, and the top 5 is a small part of it. We chose the words by a rule: the 6 cargo or place words and the 4 ship names with the most test frames. Click a frame to open its post.

Before the mapsTwo mapsSet maps

A ship name is a label of the blog that starts a post as "<name> arrived" or "<name> departed". The chart shows the 10 ship names with the most test frames and nine cargo, place and weather words. Frames and posts: Duluth Harbor Cam / LSMMA.

Where it does not work

Use it on your camera

The code has three short files, embed.py, maps.py and evaluate.py, and a fourth file, sets.py, for the maps over phrases and patches. The notebook runs the bear cam and the Duluth cam from start to end, and it has one function for your own pairs.

  1. Split by time or by visit, never at random.
  2. Start with 500 to 5,000 pairs. More pairs give more words.
  3. Query with the words of the people who wrote the captions. The maps follow the writer, not the camera.
  4. Plain words already work. The gain is in the words of the camera.
  5. Look for on-screen text, such as time stamps and labels. The maps will use it.
Open In Colab github.com/pless/register-gap-demo