Skip to content

Add DetConS examples #1957

Description

@saud5150

Add training examples for DetConS based on Efficient Visual Pretraining with Contrastive Detection.

The transform (DetConSTransform), loss (DetConSLoss), and a masked pooling utility (pool_masked in lightly/models/utils.py) are already implemented. The forward pass retains spatial backbone feature maps, pools them per mask region, and passes the resulting (B, M, D) embeddings to DetConSLoss. For the example, the built-in spatial grid heuristic (DetConSTransform(grid_size=(5, 5))) avoids any external segmentation dependency — the paper shows a 5×5 grid is optimal.

Tasks

  • Add examples/pytorch/detcon.py
  • Add examples/pytorch_lightning/detcon.py
  • Add examples/pytorch_lightning_distributed/detcon.py

Follow examples/pytorch/densecl.py as the structural template. I'd like to take this on.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions