|
@@ -186,7 +186,7 @@ st.sidebar.markdown("---")
|
|
|
# Inference Engine
|
|
# Inference Engine
|
|
|
engine_choice = st.sidebar.selectbox(
|
|
engine_choice = st.sidebar.selectbox(
|
|
|
"Select Model Engine:",
|
|
"Select Model Engine:",
|
|
|
- ["YOLO26 (ONNX - High Speed)", "YOLO26 (PyTorch - Native)", "Sawit-TBS (Benchmark)"],
|
|
|
|
|
|
|
+ ["YOLO26 (ONNX - High Speed)", "YOLO26 (PyTorch - Native)", "YOLOv8-Sawit (Benchmark)"],
|
|
|
index=0,
|
|
index=0,
|
|
|
on_change=reset_all_analysis # Clear canvas on engine switch
|
|
on_change=reset_all_analysis # Clear canvas on engine switch
|
|
|
)
|
|
)
|
|
@@ -195,7 +195,7 @@ engine_choice = st.sidebar.selectbox(
|
|
|
engine_map = {
|
|
engine_map = {
|
|
|
"YOLO26 (ONNX - High Speed)": "onnx",
|
|
"YOLO26 (ONNX - High Speed)": "onnx",
|
|
|
"YOLO26 (PyTorch - Native)": "pytorch",
|
|
"YOLO26 (PyTorch - Native)": "pytorch",
|
|
|
- "Sawit-TBS (Benchmark)": "benchmark"
|
|
|
|
|
|
|
+ "YOLOv8-Sawit (Benchmark)": "yolov8_sawit"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
st.sidebar.markdown("---")
|
|
st.sidebar.markdown("---")
|
|
@@ -205,6 +205,21 @@ model_type = engine_map[engine_choice]
|
|
|
if st.sidebar.button("❓ How to read results?", icon="📘", width='stretch'):
|
|
if st.sidebar.button("❓ How to read results?", icon="📘", width='stretch'):
|
|
|
show_tech_guide()
|
|
show_tech_guide()
|
|
|
|
|
|
|
|
|
|
+st.sidebar.markdown("---")
|
|
|
|
|
+st.sidebar.subheader("🏗️ Model Capabilities")
|
|
|
|
|
+try:
|
|
|
|
|
+ info_res = requests.get(f"{API_BASE_URL}/get_model_info", params={"model_type": model_type})
|
|
|
|
|
+ if info_res.status_code == 200:
|
|
|
|
|
+ m_info = info_res.json()
|
|
|
|
|
+ st.sidebar.caption(m_info['description'])
|
|
|
|
|
+ st.sidebar.write("**Detected Categories:**")
|
|
|
|
|
+ # Display as a cloud of tags or bullets
|
|
|
|
|
+ cols = st.sidebar.columns(2)
|
|
|
|
|
+ for i, cat in enumerate(m_info['detections_categories']):
|
|
|
|
|
+ cols[i % 2].markdown(f"- `{cat}`")
|
|
|
|
|
+except:
|
|
|
|
|
+ st.sidebar.error("Failed to load model metadata.")
|
|
|
|
|
+
|
|
|
# Function definitions moved to top
|
|
# Function definitions moved to top
|
|
|
|
|
|
|
|
def display_interactive_results(image, detections, key=None):
|
|
def display_interactive_results(image, detections, key=None):
|
|
@@ -229,7 +244,7 @@ def display_interactive_results(image, detections, key=None):
|
|
|
y_top, y_bottom = img_height - y1, img_height - y2
|
|
y_top, y_bottom = img_height - y1, img_height - y2
|
|
|
|
|
|
|
|
color = get_color(det['class'])
|
|
color = get_color(det['class'])
|
|
|
- is_bench = (st.session_state.get('engine_choice') == "Sawit-TBS (Benchmark)")
|
|
|
|
|
|
|
+ is_bench = (st.session_state.get('engine_choice') == "YOLOv8-Sawit (Benchmark)")
|
|
|
|
|
|
|
|
# The 'Hover' shape
|
|
# The 'Hover' shape
|
|
|
bunch_id = det.get('bunch_id', i+1)
|
|
bunch_id = det.get('bunch_id', i+1)
|
|
@@ -275,7 +290,7 @@ def annotate_image(image, detections):
|
|
|
conf = det['confidence']
|
|
conf = det['confidence']
|
|
|
bunch_id = det.get('bunch_id', '?')
|
|
bunch_id = det.get('bunch_id', '?')
|
|
|
color = get_color(cls)
|
|
color = get_color(cls)
|
|
|
- is_bench = (st.session_state.get('engine_choice') == "Sawit-TBS (Benchmark)")
|
|
|
|
|
|
|
+ is_bench = (st.session_state.get('engine_choice') == "YOLOv8-Sawit (Benchmark)")
|
|
|
|
|
|
|
|
# 2. Draw Heavy-Duty Bounding Box
|
|
# 2. Draw Heavy-Duty Bounding Box
|
|
|
line_width = max(6 if is_bench else 4, image.width // (80 if is_bench else 150))
|
|
line_width = max(6 if is_bench else 4, image.width // (80 if is_bench else 150))
|