Skip to content

feat(darknet): support config reload#1272

Merged
roflcoopter merged 1 commit intodevfrom
feature/darknet-reload
Mar 6, 2026
Merged

feat(darknet): support config reload#1272
roflcoopter merged 1 commit intodevfrom
feature/darknet-reload

Conversation

@roflcoopter
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 6, 2026 19:13
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 6, 2026

Deploy Preview for viseron canceled.

Name Link
🔨 Latest commit 611d5e2
🔍 Latest deploy log https://app.netlify.com/projects/viseron/deploys/69ab275965113e0008472ad6

Copy link
Copy Markdown
Contributor

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 config reload support to the darknet object detection component, enabling the component to be cleanly unloaded and re-loaded at runtime when the configuration changes.

Changes:

  • Adds an unload() top-level function to gracefully stop the darknet worker and remove it from vis.data
  • Adds an abstract stop() method to BaseDarknet with concrete implementations in DarknetDNN (delegating to SubProcessWorker.stop) and DarknetNative (delegating to ChildProcessWorker.stop)
  • Moves numpy and Viseron imports under TYPE_CHECKING guard, and adds type annotations to several abstract and concrete methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


@abstractmethod
def preprocess(self, frame):
def preprocess(self, frame: np.ndarray) -> np.ndarray | bytes:
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The BaseDarknet.preprocess abstract method's frame parameter now has a np.ndarray type annotation, and DarknetDNN.preprocess was also updated in this PR. However, DarknetNative.preprocess at line 447 still has an untyped frame parameter (def preprocess(self, frame) -> bytes:). This PR introduced the type annotation to the base class and one subclass, but missed updating DarknetNative.preprocess to be consistent.

Suggested change
def preprocess(self, frame: np.ndarray) -> np.ndarray | bytes:
def preprocess(self, frame: Any) -> np.ndarray | bytes:

Copilot uses AI. Check for mistakes.
@roflcoopter roflcoopter merged commit e7053a2 into dev Mar 6, 2026
22 of 23 checks passed
@roflcoopter roflcoopter deleted the feature/darknet-reload branch March 6, 2026 21:56
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