bplusplus 0.1.1__py3-none-any.whl → 1.2.0__py3-none-any.whl

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.

Potentially problematic release.


This version of bplusplus might be problematic. Click here for more details.

bplusplus/build_model.py DELETED
@@ -1,38 +0,0 @@
1
- import os
2
- import shutil
3
- import tempfile
4
- from typing import Any
5
-
6
- from .collect_images import Group, collect_images
7
- from .train_validate import train_validate
8
-
9
-
10
- def build_model(group_by_key: Group, search_parameters: dict[str, Any], images_per_group: int, model_output_folder: str):
11
- try:
12
- # Create a temporary directory
13
- temp_dir = tempfile.mkdtemp()
14
- # Do more work...
15
- print(f"Temporary directory path: {temp_dir}")
16
-
17
- groups = search_parameters.get(group_by_key.value, list[str])
18
-
19
- collect_images (
20
- group_by_key=group_by_key,
21
- search_parameters=search_parameters,
22
- images_per_group=images_per_group,
23
- output_directory=temp_dir
24
- )
25
-
26
- train_validate(
27
- groups=groups,
28
- dataset_path=temp_dir,
29
- output_directory=model_output_folder
30
- )
31
-
32
- finally:
33
- # Clean up the temporary directory
34
- if temp_dir and os.path.exists(temp_dir):
35
- shutil. rmtree (temp_dir)
36
- print(f"Cleaned up temporary directory: {temp_dir}")
37
-
38
- temp_dir = None
@@ -1,97 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: bplusplus
3
- Version: 0.1.1
4
- Summary: A simple method to create AI models for biodiversity
5
- License: MIT
6
- Author: Titus Venverloo
7
- Author-email: tvenver@mit.edu
8
- Requires-Python: >=3.9.0,<4.0.0
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Requires-Dist: pygbif (>=0.6.4,<0.7.0)
16
- Requires-Dist: requests (==2.25.1)
17
- Requires-Dist: ultralytics (==8.0.195)
18
- Requires-Dist: validators (>=0.33.0,<0.34.0)
19
- Description-Content-Type: text/markdown
20
-
21
- # B++ repository
22
-
23
- [![DOI](https://zenodo.org/badge/765250194.svg)](https://zenodo.org/badge/latestdoi/)
24
- [![PyPI version](https://badge.fury.io/py/bplusplus.svg)](https://badge.fury.io/py/bplusplus)
25
-
26
- This repo can be used to quickly generate YOLOv8 models for biodiversity monitoring, relying on Ultralytics and a GBIF dataset.
27
-
28
- All code is tested on macOS and Python 3.12, without GPU. GPU would obviously accelerate the below steps, Ultralytics should automatically select the available GPU if there is any.
29
-
30
- ## GitHub
31
- https://github.com/Tvenver/Bplusplus
32
-
33
-
34
- # How does it work?
35
-
36
- ![Figure 9](https://github.com/user-attachments/assets/a01f513b-0609-412d-a633-3aee1e5dded6)
37
-
38
- 1. Select scientific names you want to train your model on. For now, only scientific names are supported as training categories.
39
- 2. Select the parameters you want to use to filter your dataset (using the [parameters available in the GBIF Occurrence Search API](https://techdocs.gbif.org/en/openapi/v1/occurrence)).
40
- 3. Decide how many images you want to use for training and validation per category.
41
- 4. Select a directory to output the model information.
42
- 5. Pass the above information to the `build_model` function.
43
-
44
- You have created a YOLOv8 model for bug classification.
45
-
46
- The training and validation is done using Ultralytics. Please visit the Ultralytics YOLOv8 documentation for more information.
47
-
48
- # Pretrained Model
49
-
50
- There is also a pretrained YOLOv8 classification model, containing 2584 species, included in this repo under B++ CV Model. The included species are listed in a separate file.
51
- 1. Download the pretrained model from the Google Drive link listed in the folder B++ CV Model
52
- 2. Take the notebooks/run_model.py script, specify the path to the downloaded .pt file, and run the model.
53
-
54
- # Example Usage
55
- ## Using search options
56
- ```python
57
- import os
58
- import bplusplus
59
- from typing import Any
60
-
61
- names = [
62
- "Nabis rugosus",
63
- "Forficula auricularia",
64
- "Calosoma inquisitor",
65
- "Bombus veteranus",
66
- "Glyphotaelius pellucidus",
67
- "Notoxus monoceros",
68
- "Cacoxenus indagator",
69
- "Chorthippus mollis",
70
- "Trioza remota"
71
- ]
72
-
73
- search: dict[str, Any] = {
74
- "scientificName": names,
75
- "country": ["US", "NL"]
76
- }
77
-
78
- bplusplus.build_model(
79
- group_by_key=bplusplus.Group.scientificName,
80
- search_parameters=search,
81
- images_per_group=150,
82
- model_output_folder=os.path.join('model')
83
- )
84
- ```
85
-
86
- # Pending Improvements
87
-
88
- * The Ultralytics parameters should be surfaced to the user of the package so they have more control over the training process.
89
- * The GBIF API documentation claims that you can filter on a dataset in your search, however it does not work in my current testing. This would be nice to allow users to create datasets on the GBIF website then pass that DOI directly here, so may warrant a closer look.
90
-
91
-
92
- # Citation
93
-
94
- All information in this GitHub is available under MIT license, as long as credit is given to the authors.
95
-
96
- **Venverloo, T., Duarte, F., B++: Towards Real-Time Monitoring of Insect Species. MIT Senseable City Laboratory, AMS Institute.**
97
-
@@ -1,8 +0,0 @@
1
- bplusplus/__init__.py,sha256=KGjVcdr4nYu-_RUM-zTfkU9hIAHbJJSA1kj5jfhCzqw,130
2
- bplusplus/build_model.py,sha256=ATPnW5p5UZr_hMBa3iu1990lAfZ9q53Hhrepk-2pSv4,1121
3
- bplusplus/collect_images.py,sha256=lRYOxIFu1Cb6faAlXBiddQUmvgnksqR3nY1EFTMqyM8,4443
4
- bplusplus/train_validate.py,sha256=6_G3F5Sbl86LnRnXV6ClZfzbnTv9FZzDMIDhHVdDz6M,2604
5
- bplusplus-0.1.1.dist-info/LICENSE,sha256=rRkeHptDnlmviR0_WWgNT9t696eys_cjfVUU8FEO4k4,1071
6
- bplusplus-0.1.1.dist-info/METADATA,sha256=eK-iDIk0DD3Q_qaQTHhfYYkJmq8s3OjTn8jE69Ce3NU,3777
7
- bplusplus-0.1.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
8
- bplusplus-0.1.1.dist-info/RECORD,,