rgautroncgiar commited on
Commit
f6ec7b1
β€’
1 Parent(s): 21d24a1

improving documentation

Browse files
Files changed (2) hide show
  1. README.md +35 -6
  2. scripts/test_script.py +4 -1
README.md CHANGED
@@ -34,29 +34,40 @@ base_model: Ultralytics/YOLOv8
34
  ---
35
  [Croppie](https://croppie.org/) cherry detection model Β© 2024 by [Alliance Bioversity & CIAT](https://alliancebioversityciat.org/), [Producers Direct](https://producersdirect.org/) and [M-Omulimisa](https://m-omulimisa.com/) is licensed under [GNU-GPLv3](https://www.gnu.org/licenses/quick-guide-gplv3.html)
36
 
 
 
37
  ## General description
38
- Ultralytics' Yolo V8 medium model fined tuned for coffee cherry detection using the [Croppie coffee dataset](https://huggingface.co/datasets/rgautroncgiar/croppie_coffee_ug).
39
 
40
- ![](images/annotated_1688033955437_.jpg)
41
-
42
- **Note: the low visibility/unsure class was not used for model fine tuning**
43
 
44
  The predicted numerical classes correspond to the following cherry types:
45
  ```
46
  {0: "dark_brown_cherry", 1: "green_cherry", 2: "red_cherry", 3: "yellow_cherry"}
47
  ```
48
 
 
 
 
 
 
 
 
 
 
 
 
49
  ## Repository structure
50
 
51
  ```
52
  .
53
  β”œβ”€β”€ images
54
- β”‚Β Β  β”œβ”€β”€ 1688033955437.jpg # image for test
55
- β”‚Β Β  └── annotated_1688033955437_.jpg
56
  β”œβ”€β”€ model_v3_202402021.pt # fine tuning of Yolo v8
57
  β”œβ”€β”€ README.md
58
  β”œβ”€β”€ LICENSE.txt # detailed term of the software license
59
  └── scripts
 
60
  β”œβ”€β”€ render_results.py # helper function to annotate predictions
61
  β”œβ”€β”€ requirements.txt # pip requirements
62
  └── test_script.py # test script
@@ -67,6 +78,20 @@ Assuming you are in the ```scripts``` folder, you can run ```python3 test_script
67
 
68
  Make sure that the Python packages found in ```requirements.txt``` are installed. In case they are not, simply run ```pip3 install -r requirements.txt```.
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  ## License
71
  [Croppie](https://croppie.org/) cherry detection model Β© 2024 by [Alliance Bioversity & CIAT](https://alliancebioversityciat.org/), [Producers Direct](https://producersdirect.org/) and [M-Omulimisa](https://m-omulimisa.com/) is licensed under [GNU-GPLv3](https://www.gnu.org/licenses/quick-guide-gplv3.html)
72
 
@@ -77,3 +102,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
77
  You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
78
 
79
  The detailed terms of the license are available in the ```LICENSE``` file in the repository.
 
 
 
 
 
34
  ---
35
  [Croppie](https://croppie.org/) cherry detection model Β© 2024 by [Alliance Bioversity & CIAT](https://alliancebioversityciat.org/), [Producers Direct](https://producersdirect.org/) and [M-Omulimisa](https://m-omulimisa.com/) is licensed under [GNU-GPLv3](https://www.gnu.org/licenses/quick-guide-gplv3.html)
36
 
37
+ **Funded by**: Deutsche Gesellschaft fΓΌr Internationale Zusammenarbeit (GIZ) [Fair Forward Initiative - AI for All](https://huggingface.co/fair-forward)
38
+
39
  ## General description
40
+ Ultralytics' Yolo V8 medium [model fined tuned](https://yolov8.org/how-to-use-fine-tune-yolov8/) for coffee cherry detection using the [Croppie coffee dataset](https://huggingface.co/datasets/rgautroncgiar/croppie_coffee_ug).
41
 
42
+ This algorithm provides automated cherry count from RGB pictures. Takes as input a picture and returns the cherry count by class.
 
 
43
 
44
  The predicted numerical classes correspond to the following cherry types:
45
  ```
46
  {0: "dark_brown_cherry", 1: "green_cherry", 2: "red_cherry", 3: "yellow_cherry"}
47
  ```
48
 
49
+ **Examples of use**:
50
+ * yield estimates
51
+ * ripeness detection
52
+
53
+ **Limitations:** This algorithm does not include correction of cherry occlusion.
54
+
55
+ ![](images/annotated_1688033955437_.jpg)
56
+
57
+ **Note: the low visibility/unsure class was not used for model fine tuning**
58
+
59
+
60
  ## Repository structure
61
 
62
  ```
63
  .
64
  β”œβ”€β”€ images
65
+ β”‚Β Β  β”œβ”€β”€ foo.bar # images for the documentation
 
66
  β”œβ”€β”€ model_v3_202402021.pt # fine tuning of Yolo v8
67
  β”œβ”€β”€ README.md
68
  β”œβ”€β”€ LICENSE.txt # detailed term of the software license
69
  └── scripts
70
+ β”œβ”€β”€ custom_training.py # script which overwrites the default YOLO training method
71
  β”œβ”€β”€ render_results.py # helper function to annotate predictions
72
  β”œβ”€β”€ requirements.txt # pip requirements
73
  └── test_script.py # test script
 
78
 
79
  Make sure that the Python packages found in ```requirements.txt``` are installed. In case they are not, simply run ```pip3 install -r requirements.txt```.
80
 
81
+ A live demonstration is freely accesible [here](https://croppie.org/).
82
+
83
+ ## Training metrics
84
+ ![](images/training_results.png)
85
+
86
+ The model has been trained using the custom YOLO class found in ```./scripts/custom_YOLO.py```. The custom YOLO class can be exactly used as the original [YOLO class](https://docs.ultralytics.com/reference/models/yolo/model/). The hyperparameters used during the training can be found in ```./scripts/args.yaml```.
87
+
88
+ ## Test metrics
89
+
90
+ <img src="images/F1_curve.png" width="300">
91
+ <img src="images/P_curve.png" width="300">
92
+ <img src="images/PR_curve.png" width="300">
93
+ <img src="images/R_curve.png" width="300">
94
+
95
  ## License
96
  [Croppie](https://croppie.org/) cherry detection model Β© 2024 by [Alliance Bioversity & CIAT](https://alliancebioversityciat.org/), [Producers Direct](https://producersdirect.org/) and [M-Omulimisa](https://m-omulimisa.com/) is licensed under [GNU-GPLv3](https://www.gnu.org/licenses/quick-guide-gplv3.html)
97
 
 
102
  You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
103
 
104
  The detailed terms of the license are available in the ```LICENSE``` file in the repository.
105
+
106
+ ## Funding
107
+
108
+ **Funded by**: Deutsche Gesellschaft fΓΌr Internationale Zusammenarbeit (GIZ) [Fair Forward Initiative - AI for All](https://huggingface.co/fair-forward)
scripts/test_script.py CHANGED
@@ -21,7 +21,10 @@ if __name__=='__main__':
21
  'red_cherry': '#F44336',
22
  'dark_brown_cherry': '#C36105',
23
  'low_visibility_unsure': '#02D5FA'}
24
- class_dic = {1: 'green_cherry', 3: 'yellow_cherry', 2: 'red_cherry', 0: 'dark_brown_cherry'}
 
 
 
25
  render = annotate_image_prediction(
26
  image_path=image_path,
27
  yolo_boxes=results[0].boxes,
 
21
  'red_cherry': '#F44336',
22
  'dark_brown_cherry': '#C36105',
23
  'low_visibility_unsure': '#02D5FA'}
24
+ class_dic = {1: 'green_cherry',
25
+ 3: 'yellow_cherry',
26
+ 2: 'red_cherry',
27
+ 0: 'dark_brown_cherry'}
28
  render = annotate_image_prediction(
29
  image_path=image_path,
30
  yolo_boxes=results[0].boxes,