Skip to content

losses.py and clustering in main.py don't match the SCL formulation in the paper #22

Description

@xstaelen

Thanks for releasing the code for FOCAL, the soft contrastive learning + unsupervised clustering idea is great.
Going through the repo, I think the current code may not be up to date with the method described in the paper:

  • losses.py (MyInfoNCE / info_nce) implements a fairly standard InfoNCE-style contrastive loss with a hard pristine/forged partition. The paper's Section III-A describes a soft contrastive learning (SCL) loss with optimizable per-pixel weight coefficients w_ij, computed via an alternating Lagrangian optimization against category centers M_0/M_1 (Eqs. 1–9). I don't see that weighting/optimization implemented anywhere.

  • main.py uses torch_kmeans.KMeans(n_clusters=2, ...) for test-time clustering, whereas the paper states HDBSCAN (min cluster size 200) is the clustering method actually adopted for FOCAL, specifically because it avoids forcing two clusters on purely pristine images (Section III-B, Table VIII).

Is there an updated version of these files, or a different branch/commit, that implements the w_ij-weighted SCL loss and the HDBSCAN-based testing pipeline? Thanks again for the interesting work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions