Skip to content

Conversation

Yael27V
Copy link

@Yael27V Yael27V commented May 25, 2025

Summary

This Pull Request integrates a full graphical user interface (GUI) to simplify configuration and execution of training and prediction tasks in the AOC Fruit Detector system.

What's Included

  • GUI built with Tkinter for:
    • Editing ros_params.yaml, non_ros_params.yaml, and training_params.yaml
    • Running training and predictions (ROS / non-ROS)
    • Updating image/test directories interactively
    • Displaying live statistics and validation
  • New post-prediction menus with detailed feedback
  • Updated README.md with GUI usage instructions and example image

How to Launch GUI

From within the VSCode container:

python src/aoc_fruit_detector/gui_predic_trainer/main.py

Yael27V and others added 4 commits May 25, 2025 04:02
…I usage

- Implemented a complete Tkinter-based GUI for training and prediction configuration.
- Added modules: form renderer, YAML handler, prediction/training managers, tooltips, and constants.
- GUI supports editing training/prediction YAML files, launching predictions (with or without ROS), and managing outputs.
- Enhanced user experience with tooltips, field validation, and directory selectors.
- Updated README.md to include GUI usage instructions, execution commands, and GUI screenshot.

This commit fully integrates the GUI workflow into the repository.
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a comprehensive graphical user interface (GUI) built with Tkinter to simplify configuration and execution of training and prediction tasks in the AOC Fruit Detector system, replacing the need for manual YAML file editing.

  • Complete GUI implementation for editing YAML configuration files with tooltips and validation
  • Integration of training and prediction execution workflows with real-time feedback
  • Post-prediction statistics display and workflow management

Reviewed Changes

Copilot reviewed 12 out of 348 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
gui_predic_trainer/tooltip.py Implements tooltip functionality for GUI help text
gui_predic_trainer/main.py Main application entry point and workflow orchestration
gui_predic_trainer/gui_logic/yaml_handler.py YAML file loading/saving with structure preservation
gui_predic_trainer/gui_logic/training_manager.py Training process execution management
gui_predic_trainer/gui_logic/prediction_manager.py Prediction execution and statistics parsing
gui_predic_trainer/gui_logic/form_renderer.py Dynamic GUI form generation and rendering
gui_predic_trainer/constants.py Field descriptions for tooltip system
gui_predic_trainer/config_paths.py Centralized configuration file paths
config/training_parameters.yaml New training configuration file
config/ros_params.yaml Updated ROS parameter default
config/non_ros_params.yaml Updated non-ROS parameter defaults
README.md Added GUI usage documentation

print("STDERR:\n", e.stderr)

from tkinter import messagebox
messagebox.showerror("Error", "The prediction failed. Please verify that the image path is correct..")
Copy link
Preview

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message has a double period at the end ('correct..') which should be a single period.

Suggested change
messagebox.showerror("Error", "The prediction failed. Please verify that the image path is correct..")
messagebox.showerror("Error", "The prediction failed. Please verify that the image path is correct.")

Copilot uses AI. Check for mistakes.

"datasets.validation_dataset_name",
"files.config_file",
"files.model_file",
"files.config_file",
Copy link
Preview

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field 'files.config_file' appears twice in the REQUIRED_FIELDS set (lines 31 and 33). This duplication should be removed.

Suggested change
"files.config_file",

Copilot uses AI. Check for mistakes.

Comment on lines +82 to +84
try:
value = [v.strip().capitalize() == 'True' for v in value.strip('[]').split(',')]
value = CommentedSeq(value)
Copy link
Preview

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The verbose field parsing logic uses a complex list comprehension with exception handling that could be simplified and made more readable with explicit validation.

Suggested change
try:
value = [v.strip().capitalize() == 'True' for v in value.strip('[]').split(',')]
value = CommentedSeq(value)
value = value.strip()
if not value.startswith('[') or not value.endswith(']'):
messagebox.showerror("Error", "Invalid value for 'verbose'. Expected a list like [True, False, ...]")
return
try:
bool_values = value[1:-1].split(',')
parsed_values = []
for v in bool_values:
v = v.strip().capitalize()
if v not in ['True', 'False']:
raise ValueError("Invalid boolean value")
parsed_values.append(v == 'True')
value = CommentedSeq(parsed_values)

Copilot uses AI. Check for mistakes.

Comment on lines +36 to +38
x, y, _, _ = self.widget.bbox("insert")
x = x + self.widget.winfo_rootx() + 25
y = y + self.widget.winfo_rooty() + 20
Copy link
Preview

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bbox("insert") call may raise a TclError if the widget doesn't support the insert index (e.g., for Label widgets). This should be wrapped in a try-except block.

Suggested change
x, y, _, _ = self.widget.bbox("insert")
x = x + self.widget.winfo_rootx() + 25
y = y + self.widget.winfo_rooty() + 20
try:
x, y, _, _ = self.widget.bbox("insert")
x = x + self.widget.winfo_rootx() + 25
y = y + self.widget.winfo_rooty() + 20
except tk.TclError:
x = self.widget.winfo_rootx() + 25
y = self.widget.winfo_rooty() + 20

Copilot uses AI. Check for mistakes.

@marc-hanheide
Copy link
Member

@Yael27V I updated this to the latest branch and also check the sensible automated review comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants