Giter Site home page Giter Site logo

haoosz / cipr Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 0.0 825 KB

[TMLR] CiPR: An Efficient Framework with Cross-instance Positive Relations for Generalized Category Discovery

License: MIT License

Python 99.90% Shell 0.10%
generalized-category-discovery

cipr's Introduction

CiPR

arXiv License

This is the official PyTorch codes for the paper:

CiPR: An Efficient Framework with Cross-instance Positive Relations for Generalized Category Discovery
Shaozhe Hao, Kai Han, Kwan-Yee K. Wong
TMLR

teaser

TL;DR: We present an efficient GCD framework that designs a novel semi-supervised clustering method to generate reliable and high-purity cross-instance positive relations, incorporated into joint contrastive learning.


Setup

Create a conda environment cipr using

conda create -n cipr python=3.8.12
conda activate cipr
conda install pytorch==2.0.1 torchvision==0.15.2 pytorch-cuda=11.7 -c pytorch -c nvidia
pip install -r requirements.txt

Download

Pretrained model

The pretrained DINO weights can be downloaded here. Save the pretrained model to ./pretrain.

Dataset

We use finegrained datasets, including:

We also use generic image recognition datasets, including:

Run the codes

We train the model using

python run.py --dataset_name DATASET

and we test the model using

python run.py --dataset_name DATASET --mode test

The option of DATASET includes: cifar10, cifar100, imgnet100, cub, car, and herb.

Test with different clustering methods

We first obtain the extracted features to ./features using

bash scripts/get_feat.sh

With the obtained features, we test the model with our selective neighbor clustering (SNC) using

python eval_snc.py

The implementation of SNC can be found in ./snc/clustering.py. It is an efficient semi-supervised clustering method ready for deployment off the shelf.

Alternatively, we test with semi-supervised k-means using

python eval_sskmeans.py

Class number estimation

With all obtained features, we can estimate the number of classes using

python class_estimate.py

Citation

If you use this code in your research, please consider citing our paper:

@article{hao2024cipr,
    title={Ci{PR}: An Efficient Framework with Cross-instance Positive Relations for Generalized Category Discovery},
    author={Shaozhe Hao and Kai Han and Kwan-Yee K. Wong},
    journal={Transactions on Machine Learning Research},
    issn={2835-8856},
    year={2024},
    url={https://openreview.net/forum?id=1fNcpcdr1o}}

Acknowledgements

This project is based on GCD. Thanks for the great work!

cipr's People

Contributors

haoosz avatar

Stargazers

 avatar yinhao avatar Jeff Carpenter avatar Clarence avatar Samil Yalciner avatar Shihao Zhao avatar  avatar

Watchers

Samil Yalciner avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.