oskarastrom's picture
Min length hyperparam
fe5c71c
raw
history blame
2.97 kB
import gradio as gr
from gradio_scripts.file_reader import File
models = {
'master': 'models/v5m_896_300best.pt',
'elwha': 'models/YsEE20.pt',
'elwha_train': 'models/YsEKvE20.pt',
}
def Upload_Gradio(gradio_components):
with gr.Tabs():
# Tab - uploading aris files for inference
with gr.Tab("Infer ARIS"):
gr.HTML("<p align='center' style='font-size: large;font-style: italic;'>Submit an .aris file to analyze result.</p>")
with gr.Accordion("Advanced Settings", open=False):
settings = []
settings.append(gr.Dropdown(label="Model", value="master", choices=list(models.keys())))
gr.Markdown("Detection Parameters")
with gr.Row():
settings.append(gr.Slider(0, 1, value=0.05, label="Confidence Threshold", info="Confidence cutoff for detection boxes"))
settings.append(gr.Slider(0, 1, value=0.2, label="NMS IoU", info="IoU threshold for non-max suppression"))
gr.Markdown("Tracking Parameters")
with gr.Row():
settings.append(gr.Slider(0, 100, value=16, label="Min Hits", info="Minimum number of frames a fish has to appear in to count"))
settings.append(gr.Slider(0, 100, value=14, label="Max Age", info="Max age of occlusion before track is split"))
with gr.Row():
gr.Markdown("Associative Tracking")
settings.append(gr.Checkbox(value=False, label="Enabled"))
gr.Markdown("Other")
settings.append(gr.Slider(0, 3, value=0.3, label="Min Length", info="Minimum length of fish (meters) in order for it to count"))
gradio_components['hyperparams'] = settings
#Input field for aris submission
gradio_components['input'] = File(file_types=[".aris", ".ddf"], type="binary", label="ARIS Input", file_count="multiple")
# Tab - uploading old result files to review
with gr.Tab("Open Result"):
gr.HTML("""
<p align='center' style='font-size: large;font-style: italic;'>Submit an old zip file of results to visualize.</p>
<p align='center' style='font-size: large;font-style: italic;'>If you want to edit annotations, also submit an aris file.</p>
""")
# Input for .zip result file
gradio_components['result_input'] = File(file_types=[".zip"], type="binary", label="Upload result file", file_count="multiple")
# Optional input for aris file to help with annotation editing
gradio_components['result_aris_input'] = File(file_types=[".aris", ".ddf"], type="binary", label="Upload aris file (optional)", file_count="multiple")
# Button for initializing review
gradio_components['preview_result_btn'] = gr.Button("View Result")