Clustering, density estimation, and anomaly detection · Deep clustering · UCL070 · Training method
DeepCluster
Train visual representations by repeatedly clustering current features and predicting the resulting pseudo-labels.
In CodeSplash
Running this needs images, audio, video, graphs or another data type CodeSplash doesn't load yet.
- Availability
- Needs a data type CodeSplash doesn't load yet
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Train visual representations by repeatedly clustering current features and predicting the resulting pseudo-labels. This is an unsupervised training strategy using a standard image backbone, not a single uniquely specified neural architecture.
Question / hypotheses
Can an unlabeled objective improve both representation quality and the stability or usefulness of clusters? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.
Architecture / computational structure
Image backbone, feature preprocessing, repeated K-means, and a temporary classification head.
Assumptions
Learned features may encode nuisance similarities rather than semantics. Pseudo-label accuracy is not measured during unlabeled training, and collapse prevention needs monitoring.
Formula / computational definition
Given features , obtain pseudo-labels from K-means, then minimize with a temporary classification head . Recompute features and clusters periodically. Feature normalization/whitening and cluster-balanced sampling are important details of the original recipe.
Parameters and notation
Learned or fitted quantities: Backbone/head weights and periodically recomputed centroids and pseudo-labels. User-set hyperparameters/design choices: Choose backbone, feature preprocessing, cluster count, refresh frequency, image augmentation, optimizer, and handling of empty or unbalanced clusters. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.
Fitting, fine-tuning, and adaptation
Repeatedly extract features, preprocess and cluster them, then update backbone and pseudo-label head with balanced sampling. For downstream supervised fine-tuning, replace the cluster head, train the new head first, and unfreeze backbone blocks at a smaller learning rate. Use independent labeled validation for transfer performance and retain an untouched final test set.
How to use and calibrate
Separate representation evaluation from clustering evaluation: use frozen linear probes, nearest-neighbor retrieval, or downstream fine-tuning with held-out labels. Compare against a random or pretrained frozen backbone under matched protocols.
Example application
Pretrain a visual backbone from unlabeled images using cluster pseudo-labels. Define the reference population, measurement units, and success criterion before fitting; investigate whether discovered groups or alerts reflect the intended phenomenon.
Interpretation / pitfalls
Watch out
The reported result is conditional on the representation and objective. A stable partition can reflect nuisance structure such as batch, collection site, or missingness. Confirm the interpretation in original variables and an independent sample.
Python and R code examples
Authors provide PyTorch code. R can bridge to it or port feature extraction, K-means, and pseudo-label training. The paired component computes cross-entropy on supplied cluster labels; it does not perform alternating backbone training or reproduce the complete published recipe.
Component: DeepCluster pseudo-label cross-entropy component. Python: executed successfully; R: not executed (Rscript unavailable). These small fixtures establish the arithmetic operation, not full-method accuracy or reproduction of paper results.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — DeepCluster pseudo-label cross-entropy component. · needs numpy, scipy
import numpy as np
from scipy.special import logsumexp
logits=np.array([[2.,.1],[.2,1.5],[1.,.5]]); pseudo=np.array([0,1,0])
logprob=logits-logsumexp(logits,axis=1,keepdims=True)
result=-logprob[np.arange(len(pseudo)),pseudo].mean()
print(result)
Component demo, not a trained model — DeepCluster pseudo-label cross-entropy component.
logits=rbind(c(2,.1),c(.2,1.5),c(1,.5)); pseudo=c(1,2,1)
lse=apply(logits,1,function(v){m=max(v); m+log(sum(exp(v-m)))})
logprob=logits-lse; result=-mean(logprob[cbind(1:3,pseudo)])
print(result)
Sources
- Source 1openaccess.thecvf.com
- Source 2github.com
From the CodeSplash reference, entry UCL070.