Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field color labeling and decision tree #1704

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

Franziska-Sophie
Copy link
Contributor

@Franziska-Sophie Franziska-Sophie commented Mar 13, 2025

Why? What?

New pipeline for automatic field color calibration:

  • Start the python script
  • Select the images you want to label
  • Label one image after another with the build-in labeling tool (the label masks will be cached in case you want to use them again)
  • After the last image was labeled, the decision trees (one for top and bottom camera) is trained
  • The tree is converted to if-else statements in rust where the code is printed to the console and stored in a .rs file

How to Test

  • Run the script to get the decision tree
  • Use twix to check whether the image segmentation looks good

Copy link
Contributor

@oleflb oleflb left a comment

Choose a reason for hiding this comment

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

Would be nice to add types to all of your functions :)

@@ -0,0 +1 @@
*.dot
Copy link
Contributor

Choose a reason for hiding this comment

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

you are missing an empty new line

@@ -0,0 +1 @@
from .generate_tree import optimize_thresholds, predict_image, save_tree_as_dot_file
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, missing empty new line. Just run a uv run ruff format in the python workspace

data_type: str


def convert_pixels_BGR2bgrI(pixel_BGR):
Copy link
Contributor

Choose a reason for hiding this comment

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

please add type info to parameters and return type

return image_bgI


def optimize_thresholds(pixels_BGR, pixels_YCrCb, y, camera):
Copy link
Contributor

Choose a reason for hiding this comment

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

same here. Tip: use Literal["top", "bottom"] for camera (or define an enum)

Comment on lines 24 to 27
print(
"ERROR: the parameter 'camera' in function 'optimize_thresholds' can only take the following values: ['top, 'bottom']"
)
return
Copy link
Contributor

Choose a reason for hiding this comment

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

please raise Errors instead of printing

Comment on lines 9 to 13
identifier: str
data_type: str
Copy link
Contributor

Choose a reason for hiding this comment

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

please add more specific types (Literal or enum)

Comment on lines 1 to 5
import os
import cv2
import numpy as np
import sys
import re
import tempfile
import time
Copy link
Contributor

Choose a reason for hiding this comment

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

please separate std import (os, system, re, time) from third-party imports by newline

@oleflb oleflb self-assigned this Mar 13, 2025
@schmidma schmidma force-pushed the field-color-detection branch from 5689559 to 9c36821 Compare March 14, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Request for Review
Development

Successfully merging this pull request may close these issues.

3 participants