Skip to content

Refactor object detection#226

Open
hiromon0125 wants to merge 13 commits intomainfrom
ref/object-detection
Open

Refactor object detection#226
hiromon0125 wants to merge 13 commits intomainfrom
ref/object-detection

Conversation

@hiromon0125
Copy link
Copy Markdown
Contributor

@hiromon0125 hiromon0125 commented Mar 27, 2026

Description

  • Refactor object detection
  • Yolo now sorts the bounding box by id generated using tracking method

Limitations

While sorting will guarantee order, we ideally want to just pass the ids to the main process to do further processing.
However, we currently don't have the mechanisms to do that nor have feature ideas that require that knowledge, so this will be left to be investigated further by future teams.

Metrics

  • PR Confidence value(1 ~ 5): 4

Related issues

closes #186
closes #188
closes #180

@hiromon0125 hiromon0125 changed the title Ref/object detection Refactor object detection Mar 27, 2026
@hiromon0125 hiromon0125 marked this pull request as ready for review March 27, 2026 06:23
@hiromon0125 hiromon0125 requested a review from cwo3990 March 31, 2026 20:14
Copy link
Copy Markdown
Contributor

@cwo3990 cwo3990 left a comment

Choose a reason for hiding this comment

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

Got this error when trying to use the basic model:

Process Process-2:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.12/3.12.12_2/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/local/Cellar/python@3.12/3.12.12_2/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/connor/talos-rit/commander/src/tracking/detector.py", line 417, in _detect_person_worker
    bboxes = model.detect_person(frame=raw_frame)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/tracking/haar_cascade/basic_model.py", line 18, in detect_person
    frameGray, meta = self.resize_frame(
                      ^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/tracking/detector.py", line 85, in resize_frame
    scale_size = (frameHeight / size[0], frameWidth / size[1])
                                         ~~~~~~~~~~~^~~~~~~~~
ZeroDivisionError: division by zero

Copy link
Copy Markdown
Contributor

@cwo3990 cwo3990 left a comment

Choose a reason for hiding this comment

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

Got this error with the mediapipe model:

Process Process-3:
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.12/3.12.12_2/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/local/Cellar/python@3.12/3.12.12_2/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/connor/talos-rit/commander/src/tracking/detector.py", line 417, in _detect_person_worker
    bboxes = model.detect_person(frame=raw_frame)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/tracking/media_pipe/media_pipe_pose_model.py", line 111, in detect_person
    cropped = frame[y1:y2, x1:x2]
              ~~~~~^^^^^^^^^^^^^^
TypeError: slice indices must be integers or None or have an __index__ method

Copy link
Copy Markdown
Contributor

@cwo3990 cwo3990 left a comment

Choose a reason for hiding this comment

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

Mediapipepose model freezes video stream display on PySide GUI on x86 Intel-based Mac.

Copy link
Copy Markdown
Contributor

@cwo3990 cwo3990 left a comment

Choose a reason for hiding this comment

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

Getting this error with mediapipepose model:

Error calling Python override of QThread::run(): Traceback (most recent call last):
  File "/Users/connor/talos-rit/commander/src/pyside_gui/main_interface.py", line 50, in run
    frame = self.app.get_active_frame()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/talos_app.py", line 204, in get_active_frame
    return self.streamer.get_active_frame()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/streaming/streamer.py", line 92, in get_active_frame
    frame = draw_visuals(bboxes, frame)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/streaming/streamer.py", line 45, in draw_visuals
    cv2.rectangle(frame, (x1, y1), (x2, y2), BBOX_COLOR.GREEN.value, 2)
cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'rectangle'
> Overload resolution failed:
>  - Can't parse 'pt1'. Sequence item with index 0 has a wrong type
>  - Can't parse 'rec'. Expected sequence length 4, got 2
>  - Can't parse 'pt1'. Sequence item with index 0 has a wrong type
>  - Can't parse 'rec'. Expected sequence length 4, got 2

@cwo3990
Copy link
Copy Markdown
Contributor

cwo3990 commented Mar 31, 2026

Getting this error with mediapipepose model:

Error calling Python override of QThread::run(): Traceback (most recent call last):
  File "/Users/connor/talos-rit/commander/src/pyside_gui/main_interface.py", line 50, in run
    frame = self.app.get_active_frame()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/talos_app.py", line 204, in get_active_frame
    return self.streamer.get_active_frame()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/streaming/streamer.py", line 92, in get_active_frame
    frame = draw_visuals(bboxes, frame)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/connor/talos-rit/commander/src/streaming/streamer.py", line 45, in draw_visuals
    cv2.rectangle(frame, (x1, y1), (x2, y2), BBOX_COLOR.GREEN.value, 2)
cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'rectangle'
> Overload resolution failed:
>  - Can't parse 'pt1'. Sequence item with index 0 has a wrong type
>  - Can't parse 'rec'. Expected sequence length 4, got 2
>  - Can't parse 'pt1'. Sequence item with index 0 has a wrong type
>  - Can't parse 'rec'. Expected sequence length 4, got 2

Getting the same issue with the basic model now

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.

[REF] Refactor Mediapipe [REF] Refactor YOLO object detection

2 participants