<div align="center">
# Continuum: Simple Management of Complex Continual Learning Scenarios
[](https://badge.fury.io/py/continuum) [](https://travis-ci.com/Continvvm/continuum) [](https://www.codacy.com/gh/Continvvm/continuum?utm_source=github.com&utm_medium=referral&utm_content=Continvvm/continuum&utm_campaign=Badge_Grade) [](https://zenodo.org/badge/latestdoi/254864913) [](https://continuum.readthedocs.io/en/latest/?badge=latest)
[]()
[](https://continuum.readthedocs.io/)
[](https://arxiv.org/abs/2102.06253)
[](https://www.youtube.com/watch?v=ntSR5oYKyhM)
</div>
## A library for PyTorch's loading of datasets in the field of Continual Learning
Aka Continual Learning, Lifelong-Learning, Incremental Learning, etc.
Read the [documentation](https://continuum.readthedocs.io/en/latest/). <br>
Test Continuum on [Colab](https://colab.research.google.com/drive/1bRx3M1YFcol9RZxBZ51brxqGWrf4-Bzn?usp=sharing) !
### Example:
Install from and PyPi:
```bash
pip3 install continuum
```
And run!
```python
from torch.utils.data import DataLoader
from continuum import ClassIncremental
from continuum.datasets import MNIST
from continuum.tasks import split_train_val
dataset = MNIST("my/data/path", download=True, train=True)
scenario = ClassIncremental(
dataset,
increment=1,
initial_increment=5
)
print(f"Number of classes: {scenario.nb_classes}.")
print(f"Number of tasks: {scenario.nb_tasks}.")
for task_id, train_taskset in enumerate(scenario):
train_taskset, val_taskset = split_train_val(train_taskset, val_split=0.1)
train_loader = DataLoader(train_taskset, batch_size=32, shuffle=True)
val_loader = DataLoader(val_taskset, batch_size=32, shuffle=True)
for x, y, t in train_loader:
# Do your cool stuff here
```
### Supported Types of Scenarios
|Name | Acronym | Supported | Scenario |
|:----|:---|:---:|:---:|
| **New Instances** | NI | :white_check_mark: | [Instances Incremental](https://continuum.readthedocs.io/en/latest/_tutorials/scenarios/scenarios.html#instance-incremental)|
| **New Classes** | NC | :white_check_mark: |[Classes Incremental](https://continuum.readthedocs.io/en/latest/_tutorials/scenarios/scenarios.html#classes-incremental)|
| **New Instances & Classes** | NIC | :white_check_mark: | [Data Incremental](https://continuum.readthedocs.io/en/latest/_tutorials/scenarios/scenarios.html#new-class-and-instance-incremental)|
### Supported Datasets:
Most dataset from [torchvision.dasasets](https://pytorch.org/docs/stable/torchvision/datasets.html) are supported, for the complete list, look at the documentation page on datasets [here](https://continuum.readthedocs.io/en/latest/_tutorials/datasets/dataset.html).
Furthermore some "Meta"-datasets are can be create or used from numpy array or any torchvision.datasets or from a folder for datasets having a tree-like structure or by combining several dataset and creating dataset fellowships!
### Indexing
All our continual loader are iterable (i.e. you can for loop on them), and are
also indexable.
Meaning that `clloader[2]` returns the third task (index starts at 0). Likewise,
if you want to evaluate after each task, on all seen tasks do `clloader_test[:n]`.
### Example of Sample Images from a Continuum scenario
**CIFAR10**:
|<img src="images/cifar10_0.jpg" width="150">|<img src="images/cifar10_1.jpg" width="150">|<img src="images/cifar10_2.jpg" width="150">|<img src="images/cifar10_3.jpg" width="150">|<img src="images/cifar10_4.jpg" width="150">|
|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|
|Task 0 | Task 1 | Task 2 | Task 3 | Task 4|
**MNIST Fellowship (MNIST + FashionMNIST + KMNIST)**:
|<img src="images/mnist_fellowship_0.jpg" width="150">|<img src="images/mnist_fellowship_1.jpg" width="150">|<img src="images/mnist_fellowship_2.jpg" width="150">|
|:-------------------------:|:-------------------------:|:-------------------------:|
|Task 0 | Task 1 | Task 2 |
**PermutedMNIST**:
|<img src="images/mnist_permuted_0.jpg" width="150">|<img src="images/mnist_permuted_1.jpg" width="150">|<img src="images/mnist_permuted_2.jpg" width="150">|<img src="images/mnist_permuted_3.jpg" width="150">|<img src="images/mnist_permuted_4.jpg" width="150">|
|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|
|Task 0 | Task 1 | Task 2 | Task 3 | Task 4|
**RotatedMNIST**:
|<img src="images/mnist_rotated_0.jpg" width="150">|<img src="images/mnist_rotated_1.jpg" width="150">|<img src="images/mnist_rotated_2.jpg" width="150">|<img src="images/mnist_rotated_3.jpg" width="150">|<img src="images/mnist_rotated_4.jpg" width="150">|
|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|
|Task 0 | Task 1 | Task 2 | Task 3 | Task 4|
**TransformIncremental + BackgroundSwap**:
|<img src="images/background_0.jpg" width="250">|<img src="images/background_1.jpg" width="250">|<img src="images/background_2.jpg" width="250">|
|:-------------------------:|:-------------------------:|:-------------------------:|
|Task 0 | Task 1 | Task 2 |
### Citation
If you find this library useful in your work, please consider citing it:
```
@misc{douillardlesort2021continuum,
author={Douillard, Arthur and Lesort, Timothée},
title={Continuum: Simple Management of Complex Continual Learning Scenarios},
publisher={arXiv: 2102.06253},
year={2021}
}
```
### Maintainers
This project was started by a joint effort from [Arthur Douillard](https://arthurdouillard.com/) &
[Timothée Lesort](https://tlesort.github.io/), and we are currently the two maintainers.
Feel free to contribute! If you want to propose new features, please create an issue.
Contributors: [Lucas Caccia](https://github.com/pclucas14) [Lucas Cecchi](https://github.com/Lucasc-99) [Pau Rodriguez](https://github.com/prlz77), [Yury Antonov](https://github.com/yantonov),
[psychicmario](https://github.com/psychicmario), [fcld94](https://github.com/fcdl94), [Ashok Arjun](https://github.com/ashok-arjun), [Md Rifat Arefin](https://github.com/rarefin), [DanieleMugnai](https://github.com/mugnaidaniele), [Xiaohan Zou](https://github.com/Renovamen), [Umberto Cappellazzo](https://github.com/umbertocappellazzo).
### On PyPi
Our project is available on PyPi!
```bash
pip3 install continuum
```
Note that previously another project, a CI tool, was using that name. It is now
there [continuum_ci](https://pypi.org/project/continuum_ci/).
Raw data
{
"_id": null,
"home_page": "https://github.com/Continvvm/continuum",
"name": "continuum",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Arthur Douillard, Timoth\u00e9e Lesort",
"author_email": "ar.douillard@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/39/86/f3ab27dd5d2169e58a92fbf08717fbd584217342a4d5248cfe03fa3297fc/continuum-1.2.7.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n# Continuum: Simple Management of Complex Continual Learning Scenarios\n\n[](https://badge.fury.io/py/continuum) [](https://travis-ci.com/Continvvm/continuum) [](https://www.codacy.com/gh/Continvvm/continuum?utm_source=github.com&utm_medium=referral&utm_content=Continvvm/continuum&utm_campaign=Badge_Grade) [](https://zenodo.org/badge/latestdoi/254864913) [](https://continuum.readthedocs.io/en/latest/?badge=latest)\n[]()\n\n[](https://continuum.readthedocs.io/)\n[](https://arxiv.org/abs/2102.06253)\n[](https://www.youtube.com/watch?v=ntSR5oYKyhM)\n</div>\n\n## A library for PyTorch's loading of datasets in the field of Continual Learning\n\nAka Continual Learning, Lifelong-Learning, Incremental Learning, etc.\n\nRead the [documentation](https://continuum.readthedocs.io/en/latest/). <br>\nTest Continuum on [Colab](https://colab.research.google.com/drive/1bRx3M1YFcol9RZxBZ51brxqGWrf4-Bzn?usp=sharing) !\n\n### Example:\n\nInstall from and PyPi:\n```bash\npip3 install continuum\n```\n\nAnd run!\n```python\nfrom torch.utils.data import DataLoader\n\nfrom continuum import ClassIncremental\nfrom continuum.datasets import MNIST\nfrom continuum.tasks import split_train_val\n\ndataset = MNIST(\"my/data/path\", download=True, train=True)\nscenario = ClassIncremental(\n dataset,\n increment=1,\n initial_increment=5\n)\n\nprint(f\"Number of classes: {scenario.nb_classes}.\")\nprint(f\"Number of tasks: {scenario.nb_tasks}.\")\n\nfor task_id, train_taskset in enumerate(scenario):\n train_taskset, val_taskset = split_train_val(train_taskset, val_split=0.1)\n train_loader = DataLoader(train_taskset, batch_size=32, shuffle=True)\n val_loader = DataLoader(val_taskset, batch_size=32, shuffle=True)\n\n for x, y, t in train_loader:\n # Do your cool stuff here\n```\n\n### Supported Types of Scenarios\n\n|Name | Acronym |\u00a0Supported | Scenario |\n|:----|:---|:---:|:---:|\n| **New Instances** |\u00a0NI | :white_check_mark: | [Instances Incremental](https://continuum.readthedocs.io/en/latest/_tutorials/scenarios/scenarios.html#instance-incremental)|\n| **New Classes** |\u00a0NC | :white_check_mark: |[Classes Incremental](https://continuum.readthedocs.io/en/latest/_tutorials/scenarios/scenarios.html#classes-incremental)|\n| **New Instances & Classes** |\u00a0NIC | :white_check_mark: | [Data Incremental](https://continuum.readthedocs.io/en/latest/_tutorials/scenarios/scenarios.html#new-class-and-instance-incremental)|\n\n### Supported Datasets:\n\nMost dataset from [torchvision.dasasets](https://pytorch.org/docs/stable/torchvision/datasets.html) are supported, for the complete list, look at the documentation page on datasets [here](https://continuum.readthedocs.io/en/latest/_tutorials/datasets/dataset.html).\n\nFurthermore some \"Meta\"-datasets are can be create or used from numpy array or any torchvision.datasets or from a folder for datasets having a tree-like structure or by combining several dataset and creating dataset fellowships!\n\n### Indexing\n\nAll our continual loader are iterable (i.e. you can for loop on them), and are\nalso indexable.\n\nMeaning that `clloader[2]` returns the third task (index starts at 0). Likewise,\nif you want to evaluate after each task, on all seen tasks do `clloader_test[:n]`.\n\n### Example of Sample Images from a Continuum scenario\n\n**CIFAR10**:\n\n|<img src=\"images/cifar10_0.jpg\" width=\"150\">|<img src=\"images/cifar10_1.jpg\" width=\"150\">|<img src=\"images/cifar10_2.jpg\" width=\"150\">|<img src=\"images/cifar10_3.jpg\" width=\"150\">|<img src=\"images/cifar10_4.jpg\" width=\"150\">|\n|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|\n|Task 0 | Task 1 | Task 2 | Task 3 | Task 4|\n\n**MNIST Fellowship (MNIST + FashionMNIST + KMNIST)**:\n\n|<img src=\"images/mnist_fellowship_0.jpg\" width=\"150\">|<img src=\"images/mnist_fellowship_1.jpg\" width=\"150\">|<img src=\"images/mnist_fellowship_2.jpg\" width=\"150\">|\n|:-------------------------:|:-------------------------:|:-------------------------:|\n|Task 0 | Task 1 | Task 2 |\n\n\n**PermutedMNIST**:\n\n|<img src=\"images/mnist_permuted_0.jpg\" width=\"150\">|<img src=\"images/mnist_permuted_1.jpg\" width=\"150\">|<img src=\"images/mnist_permuted_2.jpg\" width=\"150\">|<img src=\"images/mnist_permuted_3.jpg\" width=\"150\">|<img src=\"images/mnist_permuted_4.jpg\" width=\"150\">|\n|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|\n|Task 0 | Task 1 | Task 2 | Task 3 | Task 4|\n\n**RotatedMNIST**:\n\n|<img src=\"images/mnist_rotated_0.jpg\" width=\"150\">|<img src=\"images/mnist_rotated_1.jpg\" width=\"150\">|<img src=\"images/mnist_rotated_2.jpg\" width=\"150\">|<img src=\"images/mnist_rotated_3.jpg\" width=\"150\">|<img src=\"images/mnist_rotated_4.jpg\" width=\"150\">|\n|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|\n|Task 0 | Task 1 | Task 2 | Task 3 | Task 4|\n\n**TransformIncremental + BackgroundSwap**:\n\n|<img src=\"images/background_0.jpg\" width=\"250\">|<img src=\"images/background_1.jpg\" width=\"250\">|<img src=\"images/background_2.jpg\" width=\"250\">|\n|:-------------------------:|:-------------------------:|:-------------------------:|\n|Task 0 | Task 1 | Task 2 |\n\n### Citation\n\nIf you find this library useful in your work, please consider citing it:\n\n```\n@misc{douillardlesort2021continuum,\n author={Douillard, Arthur and Lesort, Timoth\u00e9e},\n title={Continuum: Simple Management of Complex Continual Learning Scenarios},\n publisher={arXiv: 2102.06253},\n year={2021}\n}\n```\n\n\n### Maintainers\n\nThis project was started by a joint effort from [Arthur Douillard](https://arthurdouillard.com/) &\n[Timoth\u00e9e Lesort](https://tlesort.github.io/), and we are currently the two maintainers.\n\nFeel free to contribute! If you want to propose new features, please create an issue.\n\nContributors: [Lucas Caccia](https://github.com/pclucas14) [Lucas Cecchi](https://github.com/Lucasc-99) [Pau Rodriguez](https://github.com/prlz77), [Yury Antonov](https://github.com/yantonov),\n[psychicmario](https://github.com/psychicmario), [fcld94](https://github.com/fcdl94), [Ashok Arjun](https://github.com/ashok-arjun), [Md Rifat Arefin](https://github.com/rarefin), [DanieleMugnai](https://github.com/mugnaidaniele), [Xiaohan Zou](https://github.com/Renovamen), [Umberto Cappellazzo](https://github.com/umbertocappellazzo).\n\n\n### On PyPi\n\nOur project is available on PyPi!\n\n```bash\npip3 install continuum\n```\n\nNote that previously another project, a CI tool, was using that name. It is now\nthere [continuum_ci](https://pypi.org/project/continuum_ci/).\n",
"bugtrack_url": null,
"license": "",
"summary": "A clean and simple library for Continual Learning in PyTorch.",
"version": "1.2.7",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "296344c53a87b9fb24782190b7aaddc8",
"sha256": "baadcdbe2f5b3c05254307c73434a012f2a3d663e1be9469a03d4b82559e98e1"
},
"downloads": -1,
"filename": "continuum-1.2.7.tar.gz",
"has_sig": false,
"md5_digest": "296344c53a87b9fb24782190b7aaddc8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 118243,
"upload_time": "2023-01-02T14:23:28",
"upload_time_iso_8601": "2023-01-02T14:23:28.318547Z",
"url": "https://files.pythonhosted.org/packages/39/86/f3ab27dd5d2169e58a92fbf08717fbd584217342a4d5248cfe03fa3297fc/continuum-1.2.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-02 14:23:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Continvvm",
"github_project": "continuum",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "torch",
"specs": [
[
">=",
"1.2.0"
]
]
},
{
"name": "torchvision",
"specs": [
[
">=",
"0.4.0"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.17.2"
]
]
},
{
"name": "Pillow",
"specs": [
[
">=",
"6.2.1"
]
]
},
{
"name": "matplotlib",
"specs": [
[
">=",
"3.1.0"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.3.3"
]
]
},
{
"name": "scikit-image",
"specs": [
[
">=",
"0.15.0"
]
]
},
{
"name": "scikit-learn",
"specs": [
[
">=",
"0.24.1"
]
]
},
{
"name": "pandas",
"specs": [
[
">=",
"1.1.5"
]
]
},
{
"name": "pytest",
"specs": [
[
">=",
"5.0.1"
]
]
},
{
"name": "pytest-mock",
"specs": [
[
">=",
"3.6.1"
]
]
},
{
"name": "prospector",
"specs": [
[
">=",
"1.2.0"
]
]
},
{
"name": "h5py",
"specs": [
[
">=",
"3.1.0"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.24.0"
]
]
},
{
"name": "ImageHash",
"specs": [
[
">=",
"4.2.1"
]
]
},
{
"name": "datasets",
"specs": [
[
">=",
"1.6.0"
]
]
}
],
"lcname": "continuum"
}