active-vision 0.4.0__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. {active_vision-0.4.0 → active_vision-0.4.1}/.github/workflows/docs.yml +0 -12
  2. {active_vision-0.4.0 → active_vision-0.4.1}/PKG-INFO +7 -14
  3. {active_vision-0.4.0 → active_vision-0.4.1}/README.md +5 -11
  4. active_vision-0.4.1/docs/active_learning.ipynb +3016 -0
  5. active_vision-0.4.1/docs/preparing_data.ipynb +784 -0
  6. active_vision-0.4.1/docs/train.ipynb +676 -0
  7. {active_vision-0.4.0 → active_vision-0.4.1}/mkdocs.yml +5 -5
  8. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/imagenette/quickstart.ipynb +2 -1
  9. {active_vision-0.4.0 → active_vision-0.4.1}/pyproject.toml +2 -5
  10. active_vision-0.4.1/src/active_vision/__init__.py +3 -0
  11. {active_vision-0.4.0 → active_vision-0.4.1}/uv.lock +1 -1
  12. active_vision-0.4.0/docs/active_learning.md +0 -2154
  13. active_vision-0.4.0/docs/active_learning.md.bak +0 -2154
  14. active_vision-0.4.0/docs/active_learning_files/active_learning_12_4.png +0 -0
  15. active_vision-0.4.0/docs/active_learning_files/active_learning_14_3.png +0 -0
  16. active_vision-0.4.0/docs/active_learning_files/active_learning_14_6.png +0 -0
  17. active_vision-0.4.0/docs/active_learning_files/active_learning_38_0.png +0 -0
  18. active_vision-0.4.0/docs/active_learning_files/active_learning_7_0.png +0 -0
  19. active_vision-0.4.0/docs/active_learning_files/image-2.png +0 -0
  20. active_vision-0.4.0/docs/preparing_data.md +0 -525
  21. active_vision-0.4.0/docs/preparing_data.md.bak +0 -525
  22. active_vision-0.4.0/docs/quickstart.md +0 -2505
  23. active_vision-0.4.0/docs/quickstart.md.bak +0 -2505
  24. active_vision-0.4.0/docs/quickstart_files/image-2.png +0 -0
  25. active_vision-0.4.0/docs/quickstart_files/quickstart_25_0.png +0 -0
  26. active_vision-0.4.0/docs/quickstart_files/quickstart_30_4.png +0 -0
  27. active_vision-0.4.0/docs/quickstart_files/quickstart_32_3.png +0 -0
  28. active_vision-0.4.0/docs/quickstart_files/quickstart_32_6.png +0 -0
  29. active_vision-0.4.0/docs/quickstart_files/quickstart_9_0.png +0 -0
  30. active_vision-0.4.0/docs/train.md +0 -484
  31. active_vision-0.4.0/docs/train.md.bak +0 -484
  32. active_vision-0.4.0/docs/train_files/train_3_0.png +0 -0
  33. active_vision-0.4.0/docs/train_files/train_5_3.png +0 -0
  34. active_vision-0.4.0/docs/train_files/train_5_6.png +0 -0
  35. active_vision-0.4.0/src/active_vision/__init__.py +0 -3
  36. {active_vision-0.4.0 → active_vision-0.4.1}/.github/workflows/pypi.yaml +0 -0
  37. {active_vision-0.4.0 → active_vision-0.4.1}/.gitignore +0 -0
  38. {active_vision-0.4.0 → active_vision-0.4.1}/.python-version +0 -0
  39. {active_vision-0.4.0 → active_vision-0.4.1}/LICENSE +0 -0
  40. {active_vision-0.4.0 → active_vision-0.4.1}/assets/data_flywheel.gif +0 -0
  41. {active_vision-0.4.0 → active_vision-0.4.1}/assets/labeling_ui.png +0 -0
  42. {active_vision-0.4.0 → active_vision-0.4.1}/assets/logo.png +0 -0
  43. {active_vision-0.4.0 → active_vision-0.4.1}/assets/zero_shot_ui.png +0 -0
  44. {active_vision-0.4.0 → active_vision-0.4.1}/docs/index.md +0 -0
  45. {active_vision-0.4.0 → active_vision-0.4.1}/docs/overrides/main.html +0 -0
  46. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/00_create_dataset.ipynb +0 -0
  47. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/02_inference_unlabeled.ipynb +0 -0
  48. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/03_retrain_model.ipynb +0 -0
  49. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/04_relabel_loop.ipynb +0 -0
  50. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/05_retrain_larger.ipynb +0 -0
  51. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/dog_food_dataset/00_eda.ipynb +0 -0
  52. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/dog_food_dataset/01_label.ipynb +0 -0
  53. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/dog_food_dataset/02_train.ipynb +0 -0
  54. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/download_hf_dataset.ipynb +0 -0
  55. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/end-to-end.ipynb +0 -0
  56. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/eurosat_rgb/00_eda.ipynb +0 -0
  57. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/eurosat_rgb/01_label.ipynb +0 -0
  58. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/eurosat_rgb/02_train.ipynb +0 -0
  59. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/eurosat_rgb/03_train_all.ipynb +0 -0
  60. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/fastai_hooks.ipynb +0 -0
  61. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/get_embeddings.ipynb +0 -0
  62. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/gradio_annotator.ipynb +0 -0
  63. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/imagenette/active_learning.ipynb +0 -0
  64. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/imagenette/iterate.ipynb +0 -0
  65. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/imagenette/preparing_data.ipynb +0 -0
  66. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/imagenette/train.ipynb +0 -0
  67. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/initial_sampling.ipynb +0 -0
  68. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/oxford_iiit_pets/00_eda.ipynb +0 -0
  69. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/oxford_iiit_pets/01_label.ipynb +0 -0
  70. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/oxford_iiit_pets/02_train.ipynb +0 -0
  71. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/oxford_iiit_pets/03_train_vit.ipynb +0 -0
  72. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/oxford_iiit_pets/plot_pred_conf_ranked.ipynb +0 -0
  73. {active_vision-0.4.0 → active_vision-0.4.1}/nbs/oxford_iiit_pets/testing.ipynb +0 -0
  74. {active_vision-0.4.0 → active_vision-0.4.1}/src/active_vision/core.py +0 -0
@@ -28,17 +28,5 @@ jobs:
28
28
  run: |
29
29
  cp README.md docs/index.md
30
30
 
31
- jupyter nbconvert nbs/imagenette/quickstart.ipynb --to markdown --output-dir docs/
32
- sed -i 's/\x1b\[[0-9;]*m//g' docs/quickstart.md
33
-
34
- jupyter nbconvert nbs/imagenette/preparing_data.ipynb --to markdown --output-dir docs/
35
- sed -i 's/\x1b\[[0-9;]*m//g' docs/preparing_data.md
36
-
37
- jupyter nbconvert nbs/imagenette/active_learning.ipynb --to markdown --output-dir docs/
38
- sed -i 's/\x1b\[[0-9;]*m//g' docs/active_learning.md
39
-
40
- jupyter nbconvert nbs/imagenette/train.ipynb --to markdown --output-dir docs/
41
- sed -i 's/\x1b\[[0-9;]*m//g' docs/train.md
42
-
43
31
  - name: Deploy
44
32
  run: mkdocs gh-deploy --force
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: active-vision
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Active learning for computer vision.
5
5
  Project-URL: Homepage, https://github.com/dnth/active-vision
6
6
  Project-URL: Bug Tracker, https://github.com/dnth/active-vision/issues
@@ -16,6 +16,7 @@ Requires-Dist: loguru>=0.7.3
16
16
  Requires-Dist: seaborn>=0.13.2
17
17
  Requires-Dist: timm>=1.0.13
18
18
  Requires-Dist: transformers>=4.48.0
19
+ Requires-Dist: xinfer>=0.3.2
19
20
  Provides-Extra: dev
20
21
  Requires-Dist: black>=22.0; extra == 'dev'
21
22
  Requires-Dist: flake8>=4.0; extra == 'dev'
@@ -42,8 +43,6 @@ Requires-Dist: pygments; extra == 'docs'
42
43
  Requires-Dist: pymdown-extensions; extra == 'docs'
43
44
  Requires-Dist: sphinx; extra == 'docs'
44
45
  Requires-Dist: watchdog; extra == 'docs'
45
- Provides-Extra: zero-shot
46
- Requires-Dist: x-infer>=0.3.2; extra == 'zero-shot'
47
46
  Description-Content-Type: text/markdown
48
47
 
49
48
  [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue?style=for-the-badge&logo=python&logoColor=white)](https://pypi.org/project/active-vision/)
@@ -139,6 +138,8 @@ pip install -e .
139
138
  [![Open In Colab][colab_badge]](https://colab.research.google.com/github/dnth/active-vision/blob/main/nbs/imagenette/quickstart.ipynb)
140
139
  [![Open In Kaggle][kaggle_badge]](https://kaggle.com/kernels/welcome?src=https://github.com/dnth/active-vision/blob/main/nbs/imagenette/quickstart.ipynb)
141
140
 
141
+ The following are code snippets for the active learning loop in active-vision. I recommend running the quickstart notebook in Colab or Kaggle to see the full workflow.
142
+
142
143
  ```python
143
144
  from active_vision import ActiveLearner
144
145
 
@@ -149,11 +150,10 @@ al = ActiveLearner(name="cycle-1")
149
150
  al.load_model(model="resnet18", pretrained=True)
150
151
 
151
152
  # Load dataset
152
- train_df = pd.read_parquet("training_samples.parquet")
153
153
  al.load_dataset(train_df, filepath_col="filepath", label_col="label", batch_size=8)
154
154
 
155
155
  # Train model
156
- al.train(epochs=10, lr=5e-3, head_tuning_epochs=3)
156
+ al.train(epochs=10, lr=5e-3)
157
157
 
158
158
  # Evaluate the model on a *labeled* evaluation set
159
159
  accuracy = al.evaluate(eval_df, filepath_col="filepath", label_col="label")
@@ -177,8 +177,8 @@ samples = al.sample_combination(
177
177
  },
178
178
  )
179
179
 
180
- # Launch a Gradio UI to label the low confidence samples, save the labeled samples to a file
181
- al.label(samples, output_filename="combination.parquet")
180
+ # Launch a Gradio UI to label the samples, save the labeled samples to a file
181
+ al.label(samples, output_filename="samples.parquet")
182
182
  ```
183
183
 
184
184
  ![Gradio UI](https://raw.githubusercontent.com/dnth/active-vision/main/assets/labeling_ui.png)
@@ -191,18 +191,11 @@ Once complete, the labeled samples will be save into a new df.
191
191
  We can now add the newly labeled data to the training set.
192
192
 
193
193
  ```python
194
- # Add newly labeled data to the dataset
195
194
  al.add_to_dataset(labeled_df, output_filename="active_labeled.parquet")
196
195
  ```
197
196
 
198
197
  Repeat the process until the model is good enough. Use the dataset to train a larger model and deploy.
199
198
 
200
- > [!TIP]
201
- > For the toy dataset, I got to about 93% accuracy on the evaluation set with 200+ labeled images. The best performing model on the [leaderboard](https://github.com/fastai/imagenette) got 95.11% accuracy training on all 9469 labeled images.
202
- >
203
- > This took me about 6 iterations of relabeling. Each iteration took about 5 minutes to complete including labeling and model training (resnet18). See the [notebook](./nbs/04_relabel_loop.ipynb) for more details.
204
- >
205
- > But using the dataset of 200+ images, I trained a more capable model (convnext_small_in22k) and got 99.3% accuracy on the evaluation set. See the [notebook](./nbs/05_retrain_larger.ipynb) for more details.
206
199
 
207
200
 
208
201
  ## 📊 Benchmarks
@@ -91,6 +91,8 @@ pip install -e .
91
91
  [![Open In Colab][colab_badge]](https://colab.research.google.com/github/dnth/active-vision/blob/main/nbs/imagenette/quickstart.ipynb)
92
92
  [![Open In Kaggle][kaggle_badge]](https://kaggle.com/kernels/welcome?src=https://github.com/dnth/active-vision/blob/main/nbs/imagenette/quickstart.ipynb)
93
93
 
94
+ The following are code snippets for the active learning loop in active-vision. I recommend running the quickstart notebook in Colab or Kaggle to see the full workflow.
95
+
94
96
  ```python
95
97
  from active_vision import ActiveLearner
96
98
 
@@ -101,11 +103,10 @@ al = ActiveLearner(name="cycle-1")
101
103
  al.load_model(model="resnet18", pretrained=True)
102
104
 
103
105
  # Load dataset
104
- train_df = pd.read_parquet("training_samples.parquet")
105
106
  al.load_dataset(train_df, filepath_col="filepath", label_col="label", batch_size=8)
106
107
 
107
108
  # Train model
108
- al.train(epochs=10, lr=5e-3, head_tuning_epochs=3)
109
+ al.train(epochs=10, lr=5e-3)
109
110
 
110
111
  # Evaluate the model on a *labeled* evaluation set
111
112
  accuracy = al.evaluate(eval_df, filepath_col="filepath", label_col="label")
@@ -129,8 +130,8 @@ samples = al.sample_combination(
129
130
  },
130
131
  )
131
132
 
132
- # Launch a Gradio UI to label the low confidence samples, save the labeled samples to a file
133
- al.label(samples, output_filename="combination.parquet")
133
+ # Launch a Gradio UI to label the samples, save the labeled samples to a file
134
+ al.label(samples, output_filename="samples.parquet")
134
135
  ```
135
136
 
136
137
  ![Gradio UI](https://raw.githubusercontent.com/dnth/active-vision/main/assets/labeling_ui.png)
@@ -143,18 +144,11 @@ Once complete, the labeled samples will be save into a new df.
143
144
  We can now add the newly labeled data to the training set.
144
145
 
145
146
  ```python
146
- # Add newly labeled data to the dataset
147
147
  al.add_to_dataset(labeled_df, output_filename="active_labeled.parquet")
148
148
  ```
149
149
 
150
150
  Repeat the process until the model is good enough. Use the dataset to train a larger model and deploy.
151
151
 
152
- > [!TIP]
153
- > For the toy dataset, I got to about 93% accuracy on the evaluation set with 200+ labeled images. The best performing model on the [leaderboard](https://github.com/fastai/imagenette) got 95.11% accuracy training on all 9469 labeled images.
154
- >
155
- > This took me about 6 iterations of relabeling. Each iteration took about 5 minutes to complete including labeling and model training (resnet18). See the [notebook](./nbs/04_relabel_loop.ipynb) for more details.
156
- >
157
- > But using the dataset of 200+ images, I trained a more capable model (convnext_small_in22k) and got 99.3% accuracy on the evaluation set. See the [notebook](./nbs/05_retrain_larger.ipynb) for more details.
158
152
 
159
153
 
160
154
  ## 📊 Benchmarks