bplusplus 0.1.1__py3-none-any.whl → 1.1.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/__init__.py +5 -3
- bplusplus/{collect_images.py → collect.py} +3 -3
- bplusplus/prepare.py +573 -0
- bplusplus/train_validate.py +8 -64
- bplusplus/yolov5detect/__init__.py +1 -0
- bplusplus/yolov5detect/detect.py +444 -0
- bplusplus/yolov5detect/export.py +1530 -0
- bplusplus/yolov5detect/insect.yaml +8 -0
- bplusplus/yolov5detect/models/__init__.py +0 -0
- bplusplus/yolov5detect/models/common.py +1109 -0
- bplusplus/yolov5detect/models/experimental.py +130 -0
- bplusplus/yolov5detect/models/hub/anchors.yaml +56 -0
- bplusplus/yolov5detect/models/hub/yolov3-spp.yaml +52 -0
- bplusplus/yolov5detect/models/hub/yolov3-tiny.yaml +42 -0
- bplusplus/yolov5detect/models/hub/yolov3.yaml +52 -0
- bplusplus/yolov5detect/models/hub/yolov5-bifpn.yaml +49 -0
- bplusplus/yolov5detect/models/hub/yolov5-fpn.yaml +43 -0
- bplusplus/yolov5detect/models/hub/yolov5-p2.yaml +55 -0
- bplusplus/yolov5detect/models/hub/yolov5-p34.yaml +42 -0
- bplusplus/yolov5detect/models/hub/yolov5-p6.yaml +57 -0
- bplusplus/yolov5detect/models/hub/yolov5-p7.yaml +68 -0
- bplusplus/yolov5detect/models/hub/yolov5-panet.yaml +49 -0
- bplusplus/yolov5detect/models/hub/yolov5l6.yaml +61 -0
- bplusplus/yolov5detect/models/hub/yolov5m6.yaml +61 -0
- bplusplus/yolov5detect/models/hub/yolov5n6.yaml +61 -0
- bplusplus/yolov5detect/models/hub/yolov5s-LeakyReLU.yaml +50 -0
- bplusplus/yolov5detect/models/hub/yolov5s-ghost.yaml +49 -0
- bplusplus/yolov5detect/models/hub/yolov5s-transformer.yaml +49 -0
- bplusplus/yolov5detect/models/hub/yolov5s6.yaml +61 -0
- bplusplus/yolov5detect/models/hub/yolov5x6.yaml +61 -0
- bplusplus/yolov5detect/models/segment/yolov5l-seg.yaml +49 -0
- bplusplus/yolov5detect/models/segment/yolov5m-seg.yaml +49 -0
- bplusplus/yolov5detect/models/segment/yolov5n-seg.yaml +49 -0
- bplusplus/yolov5detect/models/segment/yolov5s-seg.yaml +49 -0
- bplusplus/yolov5detect/models/segment/yolov5x-seg.yaml +49 -0
- bplusplus/yolov5detect/models/tf.py +797 -0
- bplusplus/yolov5detect/models/yolo.py +495 -0
- bplusplus/yolov5detect/models/yolov5l.yaml +49 -0
- bplusplus/yolov5detect/models/yolov5m.yaml +49 -0
- bplusplus/yolov5detect/models/yolov5n.yaml +49 -0
- bplusplus/yolov5detect/models/yolov5s.yaml +49 -0
- bplusplus/yolov5detect/models/yolov5x.yaml +49 -0
- bplusplus/yolov5detect/utils/__init__.py +97 -0
- bplusplus/yolov5detect/utils/activations.py +134 -0
- bplusplus/yolov5detect/utils/augmentations.py +448 -0
- bplusplus/yolov5detect/utils/autoanchor.py +175 -0
- bplusplus/yolov5detect/utils/autobatch.py +70 -0
- bplusplus/yolov5detect/utils/aws/__init__.py +0 -0
- bplusplus/yolov5detect/utils/aws/mime.sh +26 -0
- bplusplus/yolov5detect/utils/aws/resume.py +41 -0
- bplusplus/yolov5detect/utils/aws/userdata.sh +27 -0
- bplusplus/yolov5detect/utils/callbacks.py +72 -0
- bplusplus/yolov5detect/utils/dataloaders.py +1385 -0
- bplusplus/yolov5detect/utils/docker/Dockerfile +73 -0
- bplusplus/yolov5detect/utils/docker/Dockerfile-arm64 +40 -0
- bplusplus/yolov5detect/utils/docker/Dockerfile-cpu +42 -0
- bplusplus/yolov5detect/utils/downloads.py +136 -0
- bplusplus/yolov5detect/utils/flask_rest_api/README.md +70 -0
- bplusplus/yolov5detect/utils/flask_rest_api/example_request.py +17 -0
- bplusplus/yolov5detect/utils/flask_rest_api/restapi.py +49 -0
- bplusplus/yolov5detect/utils/general.py +1294 -0
- bplusplus/yolov5detect/utils/google_app_engine/Dockerfile +25 -0
- bplusplus/yolov5detect/utils/google_app_engine/additional_requirements.txt +6 -0
- bplusplus/yolov5detect/utils/google_app_engine/app.yaml +16 -0
- bplusplus/yolov5detect/utils/loggers/__init__.py +476 -0
- bplusplus/yolov5detect/utils/loggers/clearml/README.md +222 -0
- bplusplus/yolov5detect/utils/loggers/clearml/__init__.py +0 -0
- bplusplus/yolov5detect/utils/loggers/clearml/clearml_utils.py +230 -0
- bplusplus/yolov5detect/utils/loggers/clearml/hpo.py +90 -0
- bplusplus/yolov5detect/utils/loggers/comet/README.md +250 -0
- bplusplus/yolov5detect/utils/loggers/comet/__init__.py +551 -0
- bplusplus/yolov5detect/utils/loggers/comet/comet_utils.py +151 -0
- bplusplus/yolov5detect/utils/loggers/comet/hpo.py +126 -0
- bplusplus/yolov5detect/utils/loggers/comet/optimizer_config.json +135 -0
- bplusplus/yolov5detect/utils/loggers/wandb/__init__.py +0 -0
- bplusplus/yolov5detect/utils/loggers/wandb/wandb_utils.py +210 -0
- bplusplus/yolov5detect/utils/loss.py +259 -0
- bplusplus/yolov5detect/utils/metrics.py +381 -0
- bplusplus/yolov5detect/utils/plots.py +517 -0
- bplusplus/yolov5detect/utils/segment/__init__.py +0 -0
- bplusplus/yolov5detect/utils/segment/augmentations.py +100 -0
- bplusplus/yolov5detect/utils/segment/dataloaders.py +366 -0
- bplusplus/yolov5detect/utils/segment/general.py +160 -0
- bplusplus/yolov5detect/utils/segment/loss.py +198 -0
- bplusplus/yolov5detect/utils/segment/metrics.py +225 -0
- bplusplus/yolov5detect/utils/segment/plots.py +152 -0
- bplusplus/yolov5detect/utils/torch_utils.py +482 -0
- bplusplus/yolov5detect/utils/triton.py +90 -0
- bplusplus-1.1.0.dist-info/METADATA +179 -0
- bplusplus-1.1.0.dist-info/RECORD +92 -0
- bplusplus/build_model.py +0 -38
- bplusplus-0.1.1.dist-info/METADATA +0 -97
- bplusplus-0.1.1.dist-info/RECORD +0 -8
- {bplusplus-0.1.1.dist-info → bplusplus-1.1.0.dist-info}/LICENSE +0 -0
- {bplusplus-0.1.1.dist-info → bplusplus-1.1.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: bplusplus
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: A simple method to create AI models for biodiversity, with collect and prepare pipeline
|
|
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: prettytable (==3.7.0)
|
|
16
|
+
Requires-Dist: pygbif (>=0.6.4,<0.7.0)
|
|
17
|
+
Requires-Dist: requests (==2.25.1)
|
|
18
|
+
Requires-Dist: ultralytics (==8.0.195)
|
|
19
|
+
Requires-Dist: validators (>=0.33.0,<0.34.0)
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# B++ repository
|
|
23
|
+
|
|
24
|
+
[](https://zenodo.org/badge/latestdoi/765250194)
|
|
25
|
+
[](https://pypi.org/project/bplusplus/)
|
|
26
|
+
[](https://pypi.org/project/bplusplus/)
|
|
27
|
+
[](https://pypi.org/project/bplusplus/)
|
|
28
|
+
[](https://pepy.tech/project/bplusplus)
|
|
29
|
+
[](https://pepy.tech/project/bplusplus)
|
|
30
|
+
[](https://pepy.tech/project/bplusplus)
|
|
31
|
+
|
|
32
|
+
This repo can be used to quickly generate YOLOv8 models for biodiversity monitoring, relying on Ultralytics and a GBIF dataset.
|
|
33
|
+
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
# How does it work?
|
|
37
|
+
|
|
38
|
+
To use the bplusplus package to train your own insect detection model, we provide four functions: `collect()`, `prepare()`, `train()`, `validate()`. When training an object detection model, you need a dataset with labeled data of insect species. For this package in the `collect()` function, we use images from the GBIF database (https://doi.org/10.15468/dl.dk9czq) and run them through a pretrained *insect detection model*, defining the bounding boxes for the insects, and add the scientific name from the file path. In that way, we are able to prepare a full dataset of labeled and classified insect data for training.
|
|
39
|
+
|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
### Install package
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
pip install bplusplus
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### bplusplus.collect()
|
|
49
|
+
|
|
50
|
+
This function takes three arguments:
|
|
51
|
+
- **search_parameters: dict[str, Any]** - List of scientific names of the species you want to collect from the GBIF database
|
|
52
|
+
- **images_per_group: int** - Number of images per species collected for training
|
|
53
|
+
- **output_directory: str** - Directory to store collected images
|
|
54
|
+
|
|
55
|
+
Example run:
|
|
56
|
+
```python
|
|
57
|
+
species_list=[ "Vanessa atalanta", "Gonepteryx rhamni", "Bombus hortorum"]
|
|
58
|
+
images_per_group=20
|
|
59
|
+
output_directory="/dataset/selected-species"
|
|
60
|
+
|
|
61
|
+
# Collect data from GBIF
|
|
62
|
+
bplusplus.collect(
|
|
63
|
+
search_parameters=species_list,
|
|
64
|
+
images_per_group=images_per_group,
|
|
65
|
+
output_directory=output_directory
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### bplusplus.prepare()
|
|
70
|
+
|
|
71
|
+
Prepares the dataset for training by performing the following steps:
|
|
72
|
+
1. Copies images from the input directory to a temporary directory.
|
|
73
|
+
2. Deletes corrupted images.
|
|
74
|
+
3. Downloads YOLOv5 weights for *insect detection* if not already present.
|
|
75
|
+
4. Runs YOLOv5 inference to generate labels for the images.
|
|
76
|
+
5. Deletes orphaned images and inferences.
|
|
77
|
+
6. Updates labels based on class mapping.
|
|
78
|
+
7. Splits the data into train, test, and validation sets.
|
|
79
|
+
8. Counts the total number of images across all splits.
|
|
80
|
+
9. Makes a YAML configuration file for YOLOv8.
|
|
81
|
+
|
|
82
|
+
This function takes three arguments:
|
|
83
|
+
- **input_directory: str** - The path to the input directory containing the images.
|
|
84
|
+
- **output_directory: str** - The path to the output directory where the prepared dataset will be saved.
|
|
85
|
+
- **with_background: bool = False** - Set to False if you don't want to include/download background images
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
# Prepare data
|
|
89
|
+
bplusplus.prepare(
|
|
90
|
+
input_directory='/dataset/selected-species',
|
|
91
|
+
output_directory='/dataset/prepared-data',
|
|
92
|
+
with_background=False
|
|
93
|
+
)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### bplusplus.train()
|
|
97
|
+
|
|
98
|
+
This function takes five arguments:
|
|
99
|
+
- **input_yaml: str** - yaml file created to train the model
|
|
100
|
+
- **output_directory: str**
|
|
101
|
+
- **epochs: int = 30** - Number of epochs to train the model
|
|
102
|
+
- **imgsz: int = 640** - Image size
|
|
103
|
+
- **batch: int = 16** - Batch size for training
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
# Train model
|
|
107
|
+
model = bplusplus.train(
|
|
108
|
+
input_yaml="/dataset/prepared-data/dataset.yaml", # Make sure to add the correct path
|
|
109
|
+
output_directory="trained-model",
|
|
110
|
+
epochs=30,
|
|
111
|
+
batch=16
|
|
112
|
+
)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### bplusplus.validate()
|
|
116
|
+
|
|
117
|
+
This function takes two arguments:
|
|
118
|
+
- **model** - The trained YOLO model
|
|
119
|
+
- **Path to yaml file**
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
metrics = bplusplus.validate(model, '/dataset/prepared-data/dataset.yaml')
|
|
123
|
+
print(metrics)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## Full example
|
|
129
|
+
```python
|
|
130
|
+
import bplusplus
|
|
131
|
+
|
|
132
|
+
species_list=[ "Vanessa atalanta", "Gonepteryx rhamni", "Bombus hortorum"]
|
|
133
|
+
images_per_group=20
|
|
134
|
+
output_directory="/dataset/selected-species"
|
|
135
|
+
|
|
136
|
+
# Collect data from GBIF
|
|
137
|
+
bplusplus.collect(
|
|
138
|
+
search_parameters=species_list,
|
|
139
|
+
images_per_group=images_per_group,
|
|
140
|
+
output_directory=output_directory
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
# Prepare data
|
|
144
|
+
bplusplus.prepare(
|
|
145
|
+
input_directory='/dataset/selected-species',
|
|
146
|
+
output_directory='/dataset/prepared-data',
|
|
147
|
+
with_background=False
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# Train model
|
|
151
|
+
model = bplusplus.train(
|
|
152
|
+
input_yaml="/dataset/prepared-data/dataset.yaml", # Make sure to add the correct path
|
|
153
|
+
output_directory="trained-model",
|
|
154
|
+
epochs=30,
|
|
155
|
+
batch=16
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
# Validate model
|
|
159
|
+
metrics = bplusplus.validate(model, '/dataset/prepared-data/dataset.yaml')
|
|
160
|
+
print(metrics)
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
You have created a YOLOv8 model for insect detection.
|
|
165
|
+
|
|
166
|
+
# Earlier releases
|
|
167
|
+
|
|
168
|
+
There is also a pretrained YOLOv8 classification model, containing 2584 species, from an earlier release and paper.
|
|
169
|
+
The CV model as presented in the paper can be downloaded from: https://drive.google.com/file/d/1wxAIdSzx5nhTOk4izc0RIycoecSdug_Q/view?usp=sharing
|
|
170
|
+
|
|
171
|
+
To run/use the model, please consult the Ultralytics documentation.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
# Citation
|
|
175
|
+
|
|
176
|
+
All information in this GitHub is available under MIT license, as long as credit is given to the authors.
|
|
177
|
+
|
|
178
|
+
**Venverloo, T., Duarte, F., B++: Towards Real-Time Monitoring of Insect Species. MIT Senseable City Laboratory, AMS Institute.**
|
|
179
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
bplusplus/__init__.py,sha256=Vri3TWLHiH03K70S3tpoF_O5wt57Fclt6ihiCzBaQcI,147
|
|
2
|
+
bplusplus/collect.py,sha256=r9_9DJV_xGBV3HTgxXuBtX6GflyHvEHdqqa80Y3Xrx4,4440
|
|
3
|
+
bplusplus/prepare.py,sha256=NkurFo-Lde0SUTWUFwy_eqKVq6qWn9f5N6fQko-YNi0,23261
|
|
4
|
+
bplusplus/train_validate.py,sha256=uqWPXyknoAYXkFIg_YOynd1UnBraibI1fliFOK5vWwE,533
|
|
5
|
+
bplusplus/yolov5detect/__init__.py,sha256=cJHh6ghuMGuFRqbgzTEEBN7suDZ6bhR_eLu0N1oR9Yc,23
|
|
6
|
+
bplusplus/yolov5detect/detect.py,sha256=bq-3n4hIXUlIHlU88H0NR2COTWWMELBVxtfzWTyChdI,24144
|
|
7
|
+
bplusplus/yolov5detect/export.py,sha256=kQ7hqgXu0XRbQ7K2JeX9wYvfJ0hDsaDl3JNA6k8ckVQ,67724
|
|
8
|
+
bplusplus/yolov5detect/insect.yaml,sha256=dtB4vQaXJMgJC0THlO50i9Nh0k5OVnJcNiCuurAo3RU,282
|
|
9
|
+
bplusplus/yolov5detect/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
bplusplus/yolov5detect/models/common.py,sha256=iq36pAtfS8rEY6qTy8PmmWA2EDjsohaE0G0usD7WzLM,52109
|
|
11
|
+
bplusplus/yolov5detect/models/experimental.py,sha256=oltm9OcZzF10FEjNAXaxw2aXQCxQLankfjq3eR_9XI4,5153
|
|
12
|
+
bplusplus/yolov5detect/models/hub/anchors.yaml,sha256=ESDqp-9NhgRq9Vq1eBIKTCIFD241i3mK_4F0bojke_w,3336
|
|
13
|
+
bplusplus/yolov5detect/models/hub/yolov3-spp.yaml,sha256=A-ZN_7C5Lxh2ZO7QxQravaG3W6Ch2RtYS_qsHeqHjf8,1589
|
|
14
|
+
bplusplus/yolov5detect/models/hub/yolov3-tiny.yaml,sha256=en1bqwy99njDAj2ouuDe-UjXXfv-3iXsjJBNgtl_5v4,1246
|
|
15
|
+
bplusplus/yolov5detect/models/hub/yolov3.yaml,sha256=6Pe5alcTTq5Fe7nhvxT2yfUTZ0-W758nuDJRpr74Ado,1580
|
|
16
|
+
bplusplus/yolov5detect/models/hub/yolov5-bifpn.yaml,sha256=K4J1SAcosvHALJSsqNibMEVpEBPXyLrn0HZ8hqJZNLU,1440
|
|
17
|
+
bplusplus/yolov5detect/models/hub/yolov5-fpn.yaml,sha256=dPRbYpYj0kAR7b2PfCsHcAqu1w0NpCFSR7LK9gvh7PI,1229
|
|
18
|
+
bplusplus/yolov5detect/models/hub/yolov5-p2.yaml,sha256=98ibVnKl_dS5WvJUJWWy159raUf8YwXEMOu3WhWUSv0,1700
|
|
19
|
+
bplusplus/yolov5detect/models/hub/yolov5-p34.yaml,sha256=3bfwTGKUOiJd9Z4poaYnL7DSH5WcW_voTdJB1wJNlpc,1240
|
|
20
|
+
bplusplus/yolov5detect/models/hub/yolov5-p6.yaml,sha256=Ln-kluVwT-vSDnoM4FVoV1KVOwev9cy7QmfICXNy-CM,1755
|
|
21
|
+
bplusplus/yolov5detect/models/hub/yolov5-p7.yaml,sha256=XC2GP5OwWWrkMUsDR6vWtQ7ai77tavHLEsUuEpL-_Ss,2140
|
|
22
|
+
bplusplus/yolov5detect/models/hub/yolov5-panet.yaml,sha256=PAOm98M0_r9EMX_gD5p2cC2scKdhXTmMoi0IfGOlMvM,1424
|
|
23
|
+
bplusplus/yolov5detect/models/hub/yolov5l6.yaml,sha256=I6FdTD7qLJfmYl_3HDmWlCyD2qOxS53AruKop3Xjle8,1835
|
|
24
|
+
bplusplus/yolov5detect/models/hub/yolov5m6.yaml,sha256=NrBOky5yUDZM5J11BNmb7AO8jmx4JCHC57UuZsjCkRw,1837
|
|
25
|
+
bplusplus/yolov5detect/models/hub/yolov5n6.yaml,sha256=ywcoHlw6Wik0_aLbkea5dtLBNWuJ7YH3IgUAvvW_BvM,1837
|
|
26
|
+
bplusplus/yolov5detect/models/hub/yolov5s-LeakyReLU.yaml,sha256=cXLSFid5hJglWxuLlYBQrpMVAO0fzWCuciOdzHQXnpg,1513
|
|
27
|
+
bplusplus/yolov5detect/models/hub/yolov5s-ghost.yaml,sha256=RWSAZyZ9d8T7ezoHnj6BNg7TmpkDYIG7lkj1zZCNcv8,1500
|
|
28
|
+
bplusplus/yolov5detect/models/hub/yolov5s-transformer.yaml,sha256=sKWZphAw6EwBMap31Nqvshu5Bs-Bjw3n_MHCs8-fHDY,1457
|
|
29
|
+
bplusplus/yolov5detect/models/hub/yolov5s6.yaml,sha256=mUXkTz_QWJCeI8_n-2FTmTpYDQAtONy_SVPcSYgK8vE,1837
|
|
30
|
+
bplusplus/yolov5detect/models/hub/yolov5x6.yaml,sha256=mw-e-nbGugoSfen3Xz_KYqg_6ppC-p5YgYAYvO-J6jM,1837
|
|
31
|
+
bplusplus/yolov5detect/models/segment/yolov5l-seg.yaml,sha256=QMhzNskkiVd-LJqoUVofiPCJM-OpuPUOZYX4hgbdgrw,1428
|
|
32
|
+
bplusplus/yolov5detect/models/segment/yolov5m-seg.yaml,sha256=ffhiN9v5eKp2r9gQR9hOUVstFGOOysnCOokccwKdUcs,1430
|
|
33
|
+
bplusplus/yolov5detect/models/segment/yolov5n-seg.yaml,sha256=eMth48MKq6dntb8dXVBo5E_O2lvWeEZuwcSCyEAiO3s,1430
|
|
34
|
+
bplusplus/yolov5detect/models/segment/yolov5s-seg.yaml,sha256=CTqKqW0tJZ-jN49oZu-vHXOTVvDFqH6g5PP1AUrzbfc,1429
|
|
35
|
+
bplusplus/yolov5detect/models/segment/yolov5x-seg.yaml,sha256=6Fy0TLHWKE9ZjGpGaVPGPh2DUaqHJyE8ORb-r3j47KE,1430
|
|
36
|
+
bplusplus/yolov5detect/models/tf.py,sha256=Iq75_h87YcwB0qwWPKgX7Z4UbAwG5m-IXRCEy2sYvCo,33764
|
|
37
|
+
bplusplus/yolov5detect/models/yolo.py,sha256=p5fUsJBnGt-h48roctkJWyu-ZcljAFvlTAd7N2NdK5M,21030
|
|
38
|
+
bplusplus/yolov5detect/models/yolov5l.yaml,sha256=8Dstr_e5u1f_MWjnba4C4UDlxsGAn64FnucsEUI8x5Q,1418
|
|
39
|
+
bplusplus/yolov5detect/models/yolov5m.yaml,sha256=bWyz6UsR5TjW0b5f5p-GVweTB1PuQyoNFw-JYshLg3Y,1420
|
|
40
|
+
bplusplus/yolov5detect/models/yolov5n.yaml,sha256=3NcopGrlLGsgK9KBjSMHHtFEI8L3PH5sX_yrsP97J48,1420
|
|
41
|
+
bplusplus/yolov5detect/models/yolov5s.yaml,sha256=ug2QCQafPOlSwNuFyjuTfG4ernml4QZ4vZSNky0FCYo,1420
|
|
42
|
+
bplusplus/yolov5detect/models/yolov5x.yaml,sha256=4Hh7_sz5AtDdZjqVhlNZMr5ip7IESuK7DNNkZi7rR_k,1420
|
|
43
|
+
bplusplus/yolov5detect/utils/__init__.py,sha256=whZYqDx1j45ZySXEiW8i67g3cn6ziJPXdLmLhJB3VXk,3246
|
|
44
|
+
bplusplus/yolov5detect/utils/activations.py,sha256=ugtxjjSHtJBJvXDHqNHiVO9aO85btahwtsJCG_5ZOUs,5012
|
|
45
|
+
bplusplus/yolov5detect/utils/augmentations.py,sha256=tm0EOs9i7c8RqQed8VaFvZf1XTYKIeEjhYkf0l2-PXA,18950
|
|
46
|
+
bplusplus/yolov5detect/utils/autoanchor.py,sha256=FyXwW3h2OTXDRCOlefE0jCXepCdIXYF8y1fODpXGc1Q,7935
|
|
47
|
+
bplusplus/yolov5detect/utils/autobatch.py,sha256=qo0V3aq7RsJpJZME5pUT-AP4fhlWuro73wyoj189hXc,3042
|
|
48
|
+
bplusplus/yolov5detect/utils/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
49
|
+
bplusplus/yolov5detect/utils/aws/mime.sh,sha256=Qztt2vj_k3wMNZzkoqeBTPcYJ9MEOA6c7zJ0hmi9kI4,780
|
|
50
|
+
bplusplus/yolov5detect/utils/aws/resume.py,sha256=k4quzE49csIhdAFCli8OkWfzAvZ6i1y8tN1qiIeUFCE,1242
|
|
51
|
+
bplusplus/yolov5detect/utils/aws/userdata.sh,sha256=KQsrt0FlLrISiu0Vu5qoVU1FIda4sjWFC-2nbL1ju64,1247
|
|
52
|
+
bplusplus/yolov5detect/utils/callbacks.py,sha256=2q2Re8B_lQfMuj361UYFNFx1F8fZEsKuTw_1wtmItN0,2712
|
|
53
|
+
bplusplus/yolov5detect/utils/dataloaders.py,sha256=_D_CLJLpCsicL1c7ohBr_3QaYOxLGDKAo1iS0VBybww,60697
|
|
54
|
+
bplusplus/yolov5detect/utils/docker/Dockerfile,sha256=aQBkVTr0ECdDcWdjm4bAUVE0FpJxW1bTgnp4pFVvFKI,2560
|
|
55
|
+
bplusplus/yolov5detect/utils/docker/Dockerfile-arm64,sha256=_NTKf7T__WU5I0Tk-Fy5OR-5yu_cGkxdws8IDIVCXt8,1571
|
|
56
|
+
bplusplus/yolov5detect/utils/docker/Dockerfile-cpu,sha256=rs00ow8o8qBE5LQjMHuCjAS6de4xFMBv5HTDN26plj8,1824
|
|
57
|
+
bplusplus/yolov5detect/utils/downloads.py,sha256=682ubZkVQOwqyqPqJ5ZN9FisM8DB6JNSQfWsF9iJjpQ,5236
|
|
58
|
+
bplusplus/yolov5detect/utils/flask_rest_api/README.md,sha256=-2pB1cFZfEhI03NkiwHvviwBlff5AvGAoFxQYu6vpuI,1716
|
|
59
|
+
bplusplus/yolov5detect/utils/flask_rest_api/example_request.py,sha256=BAszyMyXM5o_HrBmJ61NAiWWyVsuhVL943tmGF1UTdU,365
|
|
60
|
+
bplusplus/yolov5detect/utils/flask_rest_api/restapi.py,sha256=HlVG4Rh2lAnEHYHHQsgUpDk5j1oSs3rbnNk-M5uKphU,1572
|
|
61
|
+
bplusplus/yolov5detect/utils/general.py,sha256=TWDXtn_XBaRiqvPIXXvAdHgZtP20teWIuqSdc6zhibA,51444
|
|
62
|
+
bplusplus/yolov5detect/utils/google_app_engine/Dockerfile,sha256=ECIBf0A_QholO7O81pTdbVLbD75uwQGMMSKpR5_sC8g,821
|
|
63
|
+
bplusplus/yolov5detect/utils/google_app_engine/additional_requirements.txt,sha256=QReVSIo3mm1jwDWIE405-2bg0WaaLKhzqGcgNsKr5d0,264
|
|
64
|
+
bplusplus/yolov5detect/utils/google_app_engine/app.yaml,sha256=6iiO1VFb19BvrqP3eEbu6GFWJXAQ2H5pO46IMt9b8-0,219
|
|
65
|
+
bplusplus/yolov5detect/utils/loggers/__init__.py,sha256=Lix_vDbg7ePlRpZmlALuNOcQr0fko9AChQihPHPnxJk,20257
|
|
66
|
+
bplusplus/yolov5detect/utils/loggers/clearml/README.md,sha256=B9OOmaKLRZPej4GdiSHb4npBmcgoWA3KTdQotNacmDM,10832
|
|
67
|
+
bplusplus/yolov5detect/utils/loggers/clearml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
|
+
bplusplus/yolov5detect/utils/loggers/clearml/clearml_utils.py,sha256=nS8GdG7SFUPv7peHTjwzuyJgccgfehJC76E3HDYP8aY,9695
|
|
69
|
+
bplusplus/yolov5detect/utils/loggers/clearml/hpo.py,sha256=hJEhL-wMJEZtTHJd66d3NtGLKd6LdhrY9cSoA8RsKcA,5289
|
|
70
|
+
bplusplus/yolov5detect/utils/loggers/comet/README.md,sha256=S0eEjzIPOcg0IjXI5_F1MyZjuSddlle5yVrMms_7s88,10810
|
|
71
|
+
bplusplus/yolov5detect/utils/loggers/comet/__init__.py,sha256=bgJxrYzxlspaOEBGO0-8NXnI_HtY8QxO_sZC_H0Qf_U,21596
|
|
72
|
+
bplusplus/yolov5detect/utils/loggers/comet/comet_utils.py,sha256=Z6bBtPBW82bDPrTSIPfwDnDnJYHi5VFIHYjGpoqYdPY,4823
|
|
73
|
+
bplusplus/yolov5detect/utils/loggers/comet/hpo.py,sha256=uS8q5yAo_tu8MNA14pvhpPJtGSVZBgIC703NphdT958,6930
|
|
74
|
+
bplusplus/yolov5detect/utils/loggers/comet/optimizer_config.json,sha256=7BpxMOX6356nzl_MiSMQqmPK9j2oo5N1MEceFAf8J-U,2427
|
|
75
|
+
bplusplus/yolov5detect/utils/loggers/wandb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
|
+
bplusplus/yolov5detect/utils/loggers/wandb/wandb_utils.py,sha256=yqyKxKjqZwrqPICgC1yEgwrj7Bu08fYdrkKFMR8tnes,8144
|
|
77
|
+
bplusplus/yolov5detect/utils/loss.py,sha256=CwOoU7JF7mmHtKIXNqkGBi1X8QBycnGyK24lHbyg5zg,11377
|
|
78
|
+
bplusplus/yolov5detect/utils/metrics.py,sha256=sKdiYQ7-yo5FkxWuLk0XPt4QmYKpyCpUNK6bM5fGehQ,15495
|
|
79
|
+
bplusplus/yolov5detect/utils/plots.py,sha256=VbHf6t5nFBav6C529ZqLQhGCqI4KvHQvKDTyVkca6BU,20691
|
|
80
|
+
bplusplus/yolov5detect/utils/segment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
81
|
+
bplusplus/yolov5detect/utils/segment/augmentations.py,sha256=HBUI9sVL7rKHV05gbZvkHcHG1V1g1NID9imVtGgbK9w,3773
|
|
82
|
+
bplusplus/yolov5detect/utils/segment/dataloaders.py,sha256=SNgbvyyuxsrGQ2MIPLQnh7EiqzsEAsWsGlKhYnU9U3E,13680
|
|
83
|
+
bplusplus/yolov5detect/utils/segment/general.py,sha256=RR3scKYXyxZsEQfTYyMMQAj95vU0Jy7AxMtqKYxuzMk,5944
|
|
84
|
+
bplusplus/yolov5detect/utils/segment/loss.py,sha256=fFsU_uWIfF9vrL_5CzowWemNFCIW5Gm6im8qBQFSqkU,9220
|
|
85
|
+
bplusplus/yolov5detect/utils/segment/metrics.py,sha256=OhRBEtkBeNcSKxOrc4WifQ1YBkOYLFSAWmLCcq2AoeA,6021
|
|
86
|
+
bplusplus/yolov5detect/utils/segment/plots.py,sha256=opFz72_0Q61SeoNAlBmkdSc5iL8VAQ4gDNrsDP7vQlY,6686
|
|
87
|
+
bplusplus/yolov5detect/utils/torch_utils.py,sha256=e-XIiSsKp6DqgxMm1Ddrqf9hQht0z9Jdx3CBQjHusTM,21658
|
|
88
|
+
bplusplus/yolov5detect/utils/triton.py,sha256=hltLB5G74eCnMHsGYP3b4MWV4SEHVq-rubjo_8FP3to,3790
|
|
89
|
+
bplusplus-1.1.0.dist-info/LICENSE,sha256=rRkeHptDnlmviR0_WWgNT9t696eys_cjfVUU8FEO4k4,1071
|
|
90
|
+
bplusplus-1.1.0.dist-info/METADATA,sha256=CIxpgbyi0QxL_eGKd7WkuwTniJB-jsB-uwGJGlZE1Mw,6532
|
|
91
|
+
bplusplus-1.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
92
|
+
bplusplus-1.1.0.dist-info/RECORD,,
|
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
|
-
[](https://zenodo.org/badge/latestdoi/)
|
|
24
|
-
[](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
|
-

|
|
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
|
-
|
bplusplus-0.1.1.dist-info/RECORD
DELETED
|
@@ -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,,
|
|
File without changes
|
|
File without changes
|