Skip to content

Commit c83a21c

Browse files
authored
Merge pull request #14 from cleanlab/revamp
Updated with cleanvision==0.3.0
2 parents f2100ea + f73d487 commit c83a21c

10 files changed

+2500
-6338
lines changed

DEVELOPMENT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Development
2+
3+
This guide provides a checklist for contributing new cleanvision examples.
4+
5+
- Ensure that the notebook contains cell outputs and that they look as expected in Jupyter notebook and **on GitHub**.
6+
Note this is different than our tutorials in the main cleanvision repository (where notebook cells should not be
7+
executed)! Unlike the tutorials, we want examples notebooks to also look good in GitHub's viewer (which has limited
8+
rendering functionality, so avoid things like `<div>` that GitHub's viewer does not render properly).
9+
10+
- Ensure that the jupyter notebook cells are executed in order. Additionally clear any cell blocks that are too large (
11+
eg. model training code that specifies accuracy for each epoch), it is ok if these do not have an execution number
12+
after being cleared.
13+
14+
- The first cell of the notebook should be a markdown block containing the text:
15+
```
16+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/cleanlab/cleanvision-examples/blob/main/{ relative path to notebook }.ipynb)
17+
```
18+
19+
Replace the `{ relative path to notebook }` portion with the path to the notebook relative to the root folder.
20+
21+
> eg. the [caltech256.ipynb](caltech256.ipynb) notebook will have a relative path of `caltech256.ipynb` and will have
22+
the badge:
23+
>
24+
> ```
25+
> [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/cleanlab/cleanvision-examples/blob/main/caltech256.ipynb)
26+
> ```
27+
28+
This will create a badge that will link to a Google Colab version of the notebook.
29+
30+
Note that the Colab badge links to the notebook in the main branch, so at the time of making the PR, the link will be
31+
invalid. Please remember to check that the Colab link works after the PR has been approved and merged to `main`.
32+
33+
The Colab badge must also be in its own notebook cell, not with other content.
34+
35+
- Ensure that your notebook is using the correct kernel. In jupyter notebook, you can check the notebook's metadata by
36+
navigating to `Edit` > `Edit Notebook Metadata` and check if the follow fields match this:
37+
38+
```json
39+
"kernelspec": {
40+
"name": "python3",
41+
"display_name": "Python 3 (ipykernel)",
42+
"language": "python"
43+
}
44+
```
45+
46+
- Add the notebook to the [README](README.md), ideally grouping the newly added example with any other related examples.
47+
48+
- After a new notebook has been added and pushed to `main` branch, AVOID changing the notebook and folder names, as this
49+
may break existing links referencing the example notebook throughout cleanvision documentation, blog posts, and more.
50+
51+
- If the example requires some packages other than the ones in [requirements-dev.txt](requirements-dev.txt), Please
52+
create a separate `requirements.txt` specific to that example with extra packages required. Put these requirements and
53+
any related jupyter notebooks in a directory instead of the root folder.
54+
55+
## Set up the environment for running notebooks
56+
57+
While this is not required, we recommend that you do development and testing in a virtual environment. There are a
58+
number of tools to do this, including [virtualenv](https://virtualenv.pypa.io/), [pipenv](https://pipenv.pypa.io/),
59+
and [venv](https://docs.python.org/3/library/venv.html). You
60+
can [compare](https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe)
61+
the tools and choose what is right for you. Here, we'll explain how to get set up with venv, which is built in to Python
62+
63+
```shell
64+
python3 -m venv cleanvision-examples
65+
source cleanvision-examples/bin/activate
66+
pip install --upgrade pip
67+
pip install -r requirements-dev.txt
68+
python -m ipykernel install --user --name=cleanvision-examples
69+
```
70+
71+
Choose the `cleanvision-examples` kernel in the jupyter notebook when running.
72+
73+
You only need to create the virtual environment once, but you will need to
74+
activate it every time you start a new shell. Once the virtual environment is
75+
activated, the `pip install` commands below will install dependencies into the
76+
virtual environment rather than your system Python installation.

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
# cleanvision-examples
22

3-
Notebooks demonstrating example applications of the [cleanvision](https://github.com/cleanlab/cleanvision/) library.
3+
The notebooks in this repository demonstrate the example applications
4+
of [CleanVision](https://github.com/cleanlab/cleanvision/) on following datasets.
5+
6+
- [Caltech-256](caltech256.ipynb)
7+
- [Caltech-UCSD Birds-200-2011 (CUB-200-2011)](cub200.ipynb)
8+
- [CIFAR10](cifar10.ipynb)
9+
- [Food-101](food101.ipynb)
10+
11+
For a quick-start tutorial on different ways to use this package,
12+
check [Tutorials](https://cleanvision.readthedocs.io/en/latest/tutorials/tutorial.html#)
13+
14+
## Installation
15+
16+
You can install the most recent stable version of the package via
17+
18+
```shell
19+
pip install cleanvision
20+
```
21+
22+
More information on installation can be found [here](https://cleanvision.readthedocs.io/en/latest/#installation).
23+
24+
Some recently-added examples may require the developer version of the package, which you can install via:
25+
26+
```shell
27+
pip install git+https://github.com/cleanlab/cleanvision.git
28+
```
429

5-
For a comprehensive quick-start tutorial on different ways to use this package, start with: [tutorial.ipynb](tutorial.ipynb).
630

7-
Unless stated otherwise, notebooks here correspond to the [latest bleeding-edge version](https://github.com/cleanlab/cleanvision/tree/main/) of the CleanVision package. These notebooks install this [latest version](https://github.com/cleanlab/cleanvision/tree/main/) of CleanVision (which is undergoing rapid development).
831

9-
You can instead install the most recent stable version of the package via: `pip install cleanvision`

caltech256.ipynb

Lines changed: 214 additions & 138 deletions
Large diffs are not rendered by default.

cifar10.ipynb

Lines changed: 299 additions & 309 deletions
Large diffs are not rendered by default.

cub200.ipynb

Lines changed: 170 additions & 102 deletions
Large diffs are not rendered by default.

food101.ipynb

Lines changed: 1707 additions & 1631 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)