Practical overview
When it fits
Use it when you need a research implementation for learning image features without labels, or want to evaluate pretrained representations with nearest-neighbor methods. The README provides separate ImageNet and CIFAR-10 training instructions.
Who it is for
- Computer-vision researchers studying self-supervised or unsupervised image representations.
- Practitioners training image encoders or evaluating learned features with nearest-neighbor methods.
- Developers who want pretrained ResNet weights or existing ImageNet feature representations for experiments.
Documented uses
- Train an image encoder on ImageNet or CIFAR-10 using the repository’s documented commands.
- Adjust negative-sample count, temperature, momentum and embedding dimension in ImageNet training.
- Evaluate a saved ImageNet model using nearest-neighbor classification.
- Start experiments from pretrained ResNet weights or use supplied ImageNet feature representations.
- Inspect the project’s ImageNet nearest-neighbor retrieval comparisons.
Requirements & limits
The implementation is available in a public GitHub repository with clone instructions.
- The README specifies Python 2.7 and PyTorch 0.4; PyTorch 0.3 users are directed to a separate tag.
- ImageNet data preparation and hardware configuration rely on the linked PyTorch ImageNet example.
- The updated ResNet-50 checkpoint uses 65,536 negatives and Softmax cross-entropy, while older ResNet releases use 4,096 negatives and NCE loss.
- The repository includes separate ImageNet and CIFAR-10 training commands; the documented ImageNet testing command defaults to 200 nearest neighbors. The
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Train an instance-discrimination model on ImageNet
Clone the repository and start ImageNet training with a ResNet-18 encoder.
Before you start
- Python 2.7 and PyTorch 0.4 are listed as supported.
- ImageNet data prepared according to the referenced PyTorch ImageNet example; hardware guidance is also referenced there.
- A local repository clone and the ImageNet data path (
DATAPATH).
Steps
Clone the repository: the command below.
git clone https://github.com/zhirongw/lemniscate.pytorchRun the command below.
python main.py DATAPATH --arch resnet18 -j 32 --nce-k 4096 --nce-t 0.07 --lr 0.03 --nce-m 0.5 --low-dim 128 -b 256During training, use the described K=1 nearest-neighbor validation monitoring as an estimate of feature quality.
Expected outcome
The documented training procedure uses 4,096 negative samples and a 128-dimensional embedding; training monitors feature quality with K=1 nearest-neighbor validation.
Guide limitations
- The README refers data preparation and hardware configuration to the official PyTorch ImageNet example rather than detailing them here.
- The listed environment is Python 2.7 and PyTorch 0.4; PyTorch 0.3 users are directed to tag v0.3.
- The README documents the training command, not a verified run or its completion.
Test an ImageNet model with nearest neighbors
Run the documented ImageNet evaluation using a ResNet-18 model checkpoint.
Before you start
- Python 2.7 and PyTorch 0.4 are listed as supported.
- ImageNet data prepared according to the referenced PyTorch ImageNet example.
- A model checkpoint path (
input_model.pth.tar) and the ImageNet data path (DATAPATH).
Steps
Clone the repository: the command below.
git clone https://github.com/zhirongw/lemniscate.pytorchRun the command below.
python main.py DATAPATH --arch resnet18 --resume input_model.pth.tar -eReview the evaluation using the documented default of K=200 neighbors.
Expected outcome
The documented command runs ImageNet testing with a default nearest-neighbor count of K=200.
Guide limitations
- Data preparation and hardware configuration are referred to the official PyTorch ImageNet example.
- The command is documented, but no successful execution is verified.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- zhirongw/lemniscate.pytorch · Official homepage title · retained in its source language

