Add project files
Browse files- .gitattributes +5 -0
- README.md +4 -4
- app.py +47 -0
- best.pt +3 -0
- larvae.jpg +3 -0
- requirements.txt +2 -0
- stylopidae.jpg +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
stylops4.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
larvae.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
stylops.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
varroa.jpg filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
---
|
| 2 |
title: BeeParasiteDetector
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: yellow
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 5.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
short_description: YOLOv8m detecting Varroae, Stylops and Meloidae larvae
|
| 11 |
---
|
| 12 |
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
title: BeeParasiteDetector
|
| 3 |
+
emoji: 🐝
|
| 4 |
colorFrom: yellow
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.29.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
short_description: YOLOv8m detecting Varroae, Stylops and Meloidae larvae
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from ultralytics import YOLO
|
| 3 |
+
from PIL import Image
|
| 4 |
+
|
| 5 |
+
CONF_THRESH=0.332
|
| 6 |
+
IOU=0.4
|
| 7 |
+
|
| 8 |
+
model = YOLO("best.pt")
|
| 9 |
+
|
| 10 |
+
def predict(image):
|
| 11 |
+
results = model(image, verbose=False, conf=CONF_THRESH, iou=IOU, agnostic_nms=True, rect=False)
|
| 12 |
+
results[0].names = {0: 'bee', 1: 'stylopidae', 2: 'meloidae larvae'}
|
| 13 |
+
bgr_result_img = results[0].plot()
|
| 14 |
+
rgb_result_img = Image.fromarray(bgr_result_img[..., ::-1])
|
| 15 |
+
return rgb_result_img
|
| 16 |
+
|
| 17 |
+
def main():
|
| 18 |
+
with gr.Blocks() as demo:
|
| 19 |
+
gr.HTML("<h1>Deep Learning Based Detection of Wild Bee Parasites under Natural Conditions</h1>")
|
| 20 |
+
|
| 21 |
+
with gr.Row():
|
| 22 |
+
image_input = gr.Image(type="filepath", label="Upload Image")
|
| 23 |
+
image_output = gr.Image(label="Prediction")
|
| 24 |
+
|
| 25 |
+
gr.Examples(
|
| 26 |
+
examples=["stylopidae.jpg", "larvae.jpg"],
|
| 27 |
+
inputs=image_input
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
submit_btn = gr.Button("Detect")
|
| 31 |
+
submit_btn.click(fn=predict, inputs=image_input, outputs=[image_output])
|
| 32 |
+
|
| 33 |
+
gr.HTML("""
|
| 34 |
+
<div>
|
| 35 |
+
Sources:
|
| 36 |
+
<ul>
|
| 37 |
+
<li><a href="https://observation.org/photos/111615265/">Stylopidae</a></li>
|
| 38 |
+
<li><a href="https://observation.org/photos/67773412/">Meloidae larvae</a></li>
|
| 39 |
+
</ul>
|
| 40 |
+
</div>
|
| 41 |
+
<img src="https://upload.wikimedia.org/wikipedia/commons/9/98/TU_Ilmenau_Logo_black_green.svg" alt="TU Ilmenau" style="position: absolute; bottom: 0; right: 0; width: 20vw; max-width: 250px; height: auto;">
|
| 42 |
+
""")
|
| 43 |
+
|
| 44 |
+
demo.launch()
|
| 45 |
+
|
| 46 |
+
if __name__ == '__main__':
|
| 47 |
+
main()
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afff8ec047f3248cbd38ba7d6c99bcdb565e99eb337ffcea6813999dc82161b9
|
| 3 |
+
size 52081938
|
larvae.jpg
ADDED
|
Git LFS Details
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
ultralytics==8.3.176
|
stylopidae.jpg
ADDED
|
Git LFS Details
|