Giter VIP home page Giter VIP logo

mattdl / continualprototypeevolution Goto Github PK

View Code? Open in Web Editor NEW
42.0 2.0 5.0 165 KB

Codebase for Continual Prototype Evolution (CoPE) to attain perpetually representative prototypes for online and non-stationary datastreams. Includes implementation of the Pseudo-Prototypical Proxy (PPP) loss.

License: Other

Python 90.01% Shell 9.99%
continual-learning online-learning prototypes representation-learning computer-vision deep-learning datastreaming

continualprototypeevolution's Introduction

Continual Prototype Evolution (CoPE)

Continual Prototype Evolution (CoPE) establishes online adaptation of class-representative prototypes in non-stationary data streams, exploiting latent space representations in the novel PPP-loss to enhance the state-of-the-art in continual learning.

This codebase contains the original PyTorch implementation of CoPE, along with the Split-MNIST, Split-CIFAR10, Split-CIFAR100 benchmarks. The benchmarks have both a balanced and highly imbalanced variant, resembling more real-life settings. Included baselines outperformed in these settings are: CoPE-CrossEntropy, GEM, iCaRL, GSS, reservoir sampling, finetuning, online iid, offline iid.

Keywords: continual learning, prototypical learning, online learning, incremental learning, deep learning, representation learning, catastrophic forgetting, concept drift

Results

Main scripts main_MNIST.sh, main_CIFAR10.sh, main_CIFAR100.sh contain fully automatic pipeline (auto datapreparation), with hyperparameter configs for all of the experiments in the main paper.

The balanced setups contain:

  • Split-MNIST, Split-CIFAR10, Split-CIFAR100 and
  • lower capacity benchmarks Split-MNIST-mini and Split-CIFAR10-mini.

The imbalanced setups contain (averaged over 5 different choices of dominant task):

  • Imbalanced Split-MNIST: 1 task 2k samples, others 0.2k (5 tasks)
  • Imbalanced Split-CIFAR10: 1 task 4k samples, others 0.4k (5 tasks)
  • Imbalanced Split-CIFAR100: 1 task 2k samples, others 1k (20 tasks)

Requirements

  • Python 3.7
  • Pytorch 1.5 (instructions)
  • To install dependencies:
    • Use environment.yml to create anaconda environment:

        conda env create -f environment.yml         # Env named 'cope'
        conda activate cope
      
    • Or manually, as in:

        # Create and activate environment
        conda create -n <name> python=3.7
        conda activate <name>
      
        # Pytorch (e.g. for CUDA 10.2)
        conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.2 -c pytorch
      
        # Optional
        conda install -c conda-forge matplotlib=3.1.3       # T-SNE plots
        conda install -c conda-forge scikit-learn=0.22.1
        conda install -c omnia quadprog                     # GEM baseline
      

Reproducing paper results

This final code-base is validated to produce similar results to the original results reported in the paper.

  • To avoid issues, use the exact dependency requirements defined above.
  • Original implementation doesn't re-normalize prototypes after momentum-update. Doing this slightly decreases average accuracy.
  • Final code-base results after cleanup are checked. Avg. accuracy balanced benchmarks: 94.11+-0.76 (MNIST 5 seeds), 49.61+-3.44 (CIFAR10 5 seeds), 20.51 (CIFAR100 1 seed). Report an issue or contact me if you have troubles reproducing these.

Online Data incremental learning

Although the data streams are divided into tasks to compare with task and class-incremental learning alorithms (iCaRL, GEM), in CoPE the continual learner is unaware of tasks or task transitions. This means CoPE can learn from any labeled data stream, without the bias of hand-designed task boundaries within the stream.

Learner-evaluator framework

The learner-evaluator framework defined in the paper, explicitly models all the requirements of the continual learning system.

We define the learner here for CoPE:

  • The horizon = the currently observed batch (online processing)
  • The operational memory = replay memory + prototypical memory

With the evaluator:

  • Periodicity (rho) = evaluating on task transitions
  • Eval distribution = static class distributions, evaluate on observed classes in learner

Credits

This source code is released under a Attribution-NonCommercial 4.0 International license, find out more about it in the LICENSE file.

continualprototypeevolution's People

Contributors

mattdl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

continualprototypeevolution's Issues

Missing file ?

Hi,

I'm trying to include your method as a baseline for a research project. I tried running the code following the .sh file, and I'm getting the following error

lpagec@dp-gpu2[ContinualPrototypeEvolution](main)$python main.py --tasks_to_preserve 5 --save_path results/cifar10/ --data_path ./data --log_every 100 --samples_per_task 10000 --data_file cifar10.pt --cuda yes --model prototypical.CoPE --batch_size 10 --lr 0.005 --loss_T 0.1 --p_momentum 0.99 --n_memories 100 --n_outputs 256 --n_iter 1 --n_seeds 5 demo_CIFAR10
Traceback (most recent call last):
  File "main.py", line 12, in <module>
    import metrics.plot as plot
  File "/home/ml/users/lpagec/pytorch/ContinualPrototypeEvolution/metrics/plot.py", line 4, in <module>
    import utils
ModuleNotFoundError: No module named 'utils'

Is this a file you created ? Or is there a package called utils that you are using ?

Thanks,
Lucas

Looking for appendices mentioned in the paper for more details

Hi Authors,

Your work looks very interesting and I would like to dive more into the details, however, I was not able to refer the appendices mentioned in your paper. Can you please direct me to the version where I can find the Appendices.

Regards,
tomar-s

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.