kbarnard commited on
Commit
24bbd9e
Β·
verified Β·
1 Parent(s): 015c495

add gradio app

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ 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
+ weights/megafishdetector_v0_yolov5l_640p.pt filter=lfs diff=lfs merge=lfs -text
37
+ weights/megafishdetector_v0_yolov5m_1280p.pt filter=lfs diff=lfs merge=lfs -text
38
+ weights/megafishdetector_v0_yolov5s_640p.pt filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 WHOI's Autonomous Robotics and Perception Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Megafishdetector
3
- emoji: πŸ“š
4
  colorFrom: green
5
  colorTo: purple
6
  sdk: gradio
@@ -10,5 +10,3 @@ pinned: false
10
  license: mit
11
  short_description: WARPLab detector for generic "fish"
12
  ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: megafishdetector
3
+ emoji: 🐟
4
  colorFrom: green
5
  colorTo: purple
6
  sdk: gradio
 
10
  license: mit
11
  short_description: WARPLab detector for generic "fish"
12
  ---
 
 
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import yolov5
3
+
4
+ # Load models
5
+ model_paths = {
6
+ "YOLOv5 Large 640p": "weights/megafishdetector_v0_yolov5l_640p.pt",
7
+ "YOLOv5 Medium 1280p": "weights/megafishdetector_v0_yolov5m_1280p.pt",
8
+ "YOLOv5 Small 640p": "weights/megafishdetector_v0_yolov5s_640p.pt",
9
+ }
10
+
11
+ models = {name: yolov5.load(path) for name, path in model_paths.items()}
12
+
13
+
14
+ def detect_objects(image, model_name):
15
+ model = models[model_name]
16
+ results = model(image)
17
+ return results.render()[0]
18
+
19
+
20
+ # Gradio interface
21
+ with gr.Blocks() as demo:
22
+ gr.Markdown("# megafishdetector")
23
+
24
+ with gr.Row():
25
+ with gr.Column():
26
+ image_input = gr.Image(type="numpy")
27
+ model_selector = gr.Dropdown(
28
+ choices=list(model_paths.keys()), label="Select Model"
29
+ )
30
+ submit_button = gr.Button("Submit")
31
+
32
+ with gr.Column():
33
+ image_output = gr.Image(type="numpy")
34
+
35
+ submit_button.click(
36
+ fn=detect_objects, inputs=[image_input, model_selector], outputs=image_output
37
+ )
38
+
39
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ yolov5==7.0.14
2
+ ultralytics==8.3.78
weights/README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Models
2
+
3
+ ## MegaFishDetector v0 (single class):
4
+ [Link to all weights](https://drive.google.com/drive/folders/14fA7djYvxchfdqgWnCJABV5JQETjVe0I?usp=sharing)
5
+
6
+ Models you'll find:
7
+ - megafishdetector_v0_yolov5s_640p.pt (trained 600 epochs)
8
+ - megafishdetector_v0_yolov5m_1280p.pt (trained 150 epochs)
9
+ - megafishdetector_v0_yolov5l_640p.pt (trained 450 epochs)
10
+
11
+ Data trained on:
12
+ - [AIMs Ozfish](https://github.com/open-AIMS/ozfish)
13
+ - [FathomNet (Gnathostomata phyla only)](https://www.fathomnet.org/)
14
+ - [VIAME FishTrack (50% subsampled)](https://viame.kitware.com/#/collection/62afcb66dddafb68c8442126)
15
+ - [NOAA Puget Sound Nearshore Fish (2017-2018)](https://lila.science/datasets/noaa-puget-sound-nearshore-fish)
16
+ - [DeepFish](https://alzayats.github.io/DeepFish/)
17
+ - [NOAA Labelled Fishes in the Wild](https://www.st.nmfs.noaa.gov/aiasi/DataSets.html)
weights/megafishdetector_v0_yolov5l_640p.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47117e50f9625bc83ea1d408f86145c76dc1faa6cf9c63cbc25c2d88c8cf1377
3
+ size 370061843
weights/megafishdetector_v0_yolov5m_1280p.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae46b6916767d1a652eae4b5e955caa99e3b37c0945507b15905428db748e185
3
+ size 168279579
weights/megafishdetector_v0_yolov5s_640p.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d80abde5aa4c2fde950fb4fa960d8f04695886e1a40383e248cc4894f3595af
3
+ size 14378493