tsimcne

Unsupervised visualization of image datasets using contrastive learning

https://github.com/berenslab/t-simcne

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.1%) to scientific vocabulary

Keywords

dimensionality-reduction visualization
Last synced: 6 months ago · JSON representation ·

Repository

Unsupervised visualization of image datasets using contrastive learning

Basic Info
Statistics
  • Stars: 116
  • Watchers: 4
  • Forks: 14
  • Open Issues: 2
  • Releases: 17
Topics
dimensionality-reduction visualization
Created over 3 years ago · Last pushed 9 months ago
Metadata Files
Readme Citation

readme.md

Unsupervised visualization of image datasets using contrastive learning

This is the code for the paper “Unsupervised visualization of image datasets using contrastive learning” (ICLR 2023).

If you use the code, please cite our paper: @inproceedings{boehm2023unsupervised, title={Unsupervised visualization of image datasets using contrastive learning}, author={B{\"o}hm, Jan Niklas and Berens, Philipp and Kobak, Dmitry}, booktitle={International Conference on Learning Representations}, year={2023}, }

We show that it is possible to visualize datasets such as CIFAR-10 and CIFAR-100 in 2D with a contrastive learning objective, while preserving a lot of structure! We call our method t-SimCNE.

arch

Installation

Installation should be as easy as calling: bash pip install tsimcne

The package is now available on PyPI. If you want to install it from source, you can do as follows.

bash git clone https://github.com/berenslab/t-simcne cd t-simcne pip install .

Since the project uses a pyproject.toml file, you need to make sure that pip version is at least v22.3.1.

Usage example

The documentation is available at readthedocs. Below is a simple usage example.

```python import torch import torchvision from matplotlib import pyplot as plt from tsimcne.tsimcne import TSimCNE

get the cifar dataset (make sure to adapt data_root to point to your folder)

dataroot = "experiments/cifar/out/cifar10" datasettrain = torchvision.datasets.CIFAR10( root=dataroot, download=True, train=True, ) datasettest = torchvision.datasets.CIFAR10( root=dataroot, download=True, train=False, ) datasetfull = torch.utils.data.ConcatDataset([datasettrain, datasettest])

create the object (here we run t-SimCNE with fewer epochs

than in the paper; there we used [1000, 50, 450]).

tsimcne = TSimCNE(total_epochs=[500, 50, 250])

train on the augmented/contrastive dataloader (this takes the most time)

tsimcne.fit(dataset_full)

map the original images to 2D

Y = tsimcne.transform(dataset_full)

get the original labels from the dataset

labels = [lbl for img, lbl in dataset_full]

plot the data

fig, ax = plt.subplots() ax.scatter(*Y.T, c=labels) fig.savefig("tsimcne.png") ```

CIFAR-10

annotated plot of cifar10

CIFAR-100

label density for cifar100

Reproducibility

For reproducing the results of the paper, please see the iclr2023 branch in this repository.

Owner

  • Name: Berens Lab @ University of Tübingen
  • Login: berenslab
  • Kind: organization
  • Email: philipp.berens@uni-tuebingen.de
  • Location: Tübingen, Germany

Department of Data Science at the Hertie Institute for AI in Brain Health, University of Tübingen

Citation (CITATION.bib)

@inproceedings{boehm2023unsupervised,
  title={Unsupervised visualization of image datasets using contrastive learning},
  author={B{\"o}hm, Jan Niklas and Berens, Philipp and Kobak, Dmitry},
  booktitle={International Conference on Learning Representations},
  year={2023},
}

GitHub Events

Total
  • Create event: 19
  • Issues event: 1
  • Release event: 8
  • Watch event: 5
  • Push event: 37
  • Pull request event: 2
  • Fork event: 2
Last Year
  • Create event: 19
  • Issues event: 1
  • Release event: 8
  • Watch event: 5
  • Push event: 37
  • Pull request event: 2
  • Fork event: 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 13
  • Total pull requests: 4
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 4 days
  • Total issue authors: 8
  • Total pull request authors: 4
  • Average comments per issue: 2.85
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 5 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • KonstantinWilleke (4)
  • Air000 (2)
  • erikhagendorn (2)
  • zhijie-yang (1)
  • fabioseel (1)
  • YingfanWang (1)
  • niniack (1)
  • JEFworks (1)
Pull Request Authors
  • wilsonjr (2)
  • erikhagendorn (1)
  • KonstantinWilleke (1)
  • fabioseel (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 124 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 37
  • Total maintainers: 1
pypi.org: tsimcne

Visualization tool for unsupervised image visualization (ICLR 2023)

  • Versions: 37
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 124 Last month
Rankings
Dependent packages count: 7.5%
Stargazers count: 7.5%
Forks count: 12.7%
Average: 24.4%
Dependent repos count: 69.8%
Maintainers (1)
jnb
Last synced: 6 months ago