Git Product home page Git Product logo

lf2cs's Introduction

Code Readme

The code of Unsupervised Few-Shot Image Classification by Learning Features into Clustering Space (ECCV 2022)

Abstract

Most few-shot image classification methods are trained based on tasks. Usually, tasks are built on base classes with a large number of labeled images, which consumes large effort. Unsupervised few-shot image classification methods do not need labeled images, because they require tasks to be built on unlabeled images. In order to efficiently build tasks with unlabeled images, we propose a novel single-stage clustering method: Learning Features into Clustering Space (LF2CS), which first set a separable clustering space by fixing the clustering centers and then use a learnable model to learn features into the clustering space. Based on our LF2CS, we put forward an image sampling and c-way k-shot task building method. With this, we propose a novel unsupervised few-shot image classification method, which jointly learns the learnable model, clustering and few-shot image classification. Experiments and visualization show that our LF2CS has a strong ability to generalize to the novel categories. From the perspective of image sampling, we implement four baselines according to how to build tasks. We conduct experiments on the Omniglot, miniImageNet, tieredImageNet and CIFARFS datasets based on the Conv-4 and ResNet-12 backbones. Experimental results show that ours outperform the state-of-the-art methods.

The Overall Pipeline

The overall pipeline of our approach, taking 3-way 1-shot as an example.

The overall pipeline

Installing

Install the required packages through the following command:

pip install -r requirements.txt

Data

Limited by file size, we only provide Omniglot for demonstration. You can download the data to the corresponding folder.

The organization of the data is shown below.

The overall pipeline

Training

Please unzip the Omniglot dataset before training.

You can directly train on Omniglot through the following command:

python main.py -gpuid 0 -type train -dataset omniglot

Test

Please unzip the Omniglot dataset before test.

You can directly test on Omniglot through the following command:

python main.py -gpuid 0 -type test -dataset omniglot -checkpoint ./models/omniglot/our/our.pkl

Experimental results

Table 1 shows the few-shot image classification accuracies on Omniglot.

Experimental results

Table 2 shows the few-shot image classification accuracies on miniImagenet.

Experimental results

Table 3 shows the few-shot image classification accuracies on tieredImagenet.

Experimental results

Visualizations

The figure below shows some images in some clusters, which are divided into three parts. Among them, the left, middle, and right show the images in the training, validation, and test sets of Omniglot, respectively. The images of each row come from the same cluster.

Visualization

The figure below shows some images in some clusters, which are divided into three parts. Among them, the left, middle, and right show the images in the training, validation, and test sets of miniImageNet, respectively. The images of each row come from the same cluster.

Visualization

Conclusion

In our work, we propose a novel single-stage clustering method: Learning Features into Clustering Space (LF2CS), which fixes the cluster center matrix to the identity matrix, thereby setting a strongly separable clustering space, and then learns features into the clustering space. Based on this, we put forward an image sampling and task building method, and with this, we propose an unsupervised few-shot image classification method. Experimental results and visualization show that our LF2CS has a strong ability to generalize to the novel categories. Based on Conv-4 and ResNet-12, we conduct experiments on four FSL datasets, and our method achieves the state-of-the-art results.

lf2cs's People

Contributors

lishuo1001 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.