You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,66 +12,142 @@ This repo can be used to quickly generate YOLOv8 models for biodiversity monitor
12
12
13
13
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.
14
14
15
-
## GitHub
16
-
https://github.com/Tvenver/Bplusplus
15
+
# How does it work?
17
16
17
+
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.
18
18
19
-
# How does it work?
19
+

20
+
21
+
### Install package
22
+
23
+
```python
24
+
pip install bplusplus
25
+
```
26
+
27
+
### bplusplus.collect()
28
+
29
+
This function takes three arguments:
30
+
-**search_parameters: dict[str, Any]** - List of scientific names of the species you want to collect from the GBIF database
31
+
-**images_per_group: int** - Number of images per species collected for training
32
+
-**output_directory: str** - Directory to store collected images
1. Select scientific names you want to train your model on. For now, only scientific names are supported as training categories.
24
-
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)).
25
-
3. Decide how many images you want to use for training and validation per category.
26
-
4. Select a directory to output the model information.
27
-
5. Pass the above information to the `build_model` function.
77
+
This function takes five arguments:
78
+
-**input_yaml: str** - yaml file created to train the model
79
+
-**output_directory: str**
80
+
-**epochs: int = 30** - Number of epochs to train the model
81
+
-**imgsz: int = 640** - Image size
82
+
-**batch: int = 16** - Batch size for training
28
83
29
-
You have created a YOLOv8 model for bug classification.
84
+
```python
85
+
# Train model
86
+
model = bplusplus.train(
87
+
input_yaml="/dataset/prepared-data/dataset.yaml", # Make sure to add the correct path
88
+
output_directory="trained-model",
89
+
epochs=30,
90
+
batch=16
91
+
)
92
+
```
30
93
31
-
The training and validation is done using Ultralytics. Please visit the Ultralytics YOLOv8 documentation for more information.
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.
36
-
1. Download the pretrained model from the Google Drive link listed in the folder B++ CV Model
37
-
2. Take the notebooks/run_model.py script, specify the path to the downloaded .pt file, and run the model.
You have created a YOLOv8 model for insect detection.
144
+
145
+
# Earlier releases
146
+
147
+
There is also a pretrained YOLOv8 classification model, containing 2584 species, from an earlier release and paper.
148
+
The CV model as presented in the paper can be downloaded from: https://drive.google.com/file/d/1wxAIdSzx5nhTOk4izc0RIycoecSdug_Q/view?usp=sharing
72
149
73
-
* The Ultralytics parameters should be surfaced to the user of the package so they have more control over the training process.
74
-
* 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.
150
+
To run/use the model, please consult the Ultralytics documentation.
0 commit comments