File size: 1,832 Bytes
e6748e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import streamlit as st

def streamlit_ui():
    """Creates the Streamlit user interface with input controls."""

    st.sidebar.title("Segmentation Parameters")

    uploaded_image = st.sidebar.file_uploader("Choose an image...", type=["jpg", "png", "jpeg"])

    input_size = st.sidebar.slider(
        "Input Size", 512, 3000, 1024, 64,
        help="Size of the input image. Higher values may improve detection but will be slower."
    )

    iou_threshold = st.sidebar.slider(
        "IOU Threshold", 0.0, 0.9, 0.7, 0.1, 
        help="Intersection over Union threshold for object detection. Higher values reduce false positives."
    )

    conf_threshold = st.sidebar.slider(
        "Confidence Threshold", 0.0, 0.9, 0.5, 0.01, 
        help="Minimum confidence level for detected objects. Lower values may detect more objects but increase false positives."
    )

    better_quality = st.sidebar.checkbox(
        "Better Visual Quality", True, 
        help="Check to improve the visual quality of the segmentation. May be slower."
    )

    contour_thickness = st.sidebar.slider(
        "Contour Thickness", 1, 50, 1,
        help="Thickness of the contour lines around detected objects."
    )

    real_world_length = st.sidebar.number_input(
        "Enter the real-world length of the line in micrometers:", 
        min_value=1, value=100,
        help="Length of the reference line in the real world, used for scaling object parameters."
    )
    
    max_det = st.sidebar.number_input(
        "Maximum Number of Detected Objects", 
        min_value=1, value=500,
        help="Maximum number of detected objects. Higher values may have significant impact on performance."
    )
    return uploaded_image, input_size, iou_threshold, conf_threshold, better_quality, contour_thickness, real_world_length, max_det