Skip to content

Code cleanup, README updates, interfaces for predictions and metric results - #20

Open
dtronmans wants to merge 6 commits into
develop-v0.1.0from
feat/code-quality-and-cleanup
Open

Code cleanup, README updates, interfaces for predictions and metric results#20
dtronmans wants to merge 6 commits into
develop-v0.1.0from
feat/code-quality-and-cleanup

Conversation

@dtronmans

@dtronmans dtronmans commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Purpose

  • Parsers now return a shared Prediction container instead of task-specific raw message types
  • Evaluation now returns structured EvaluationResult / ThroughputResult objects instead of loose dicts
  • YOLO parsing and instance-mask reconstruction helpers moved to parsers/utils/yolo.py
  • segmentation metric preprocessing and formatting centralized in metrics/utils/segmentation.py
  • segmentation metrics (MIoU, DiceCoefficient, F1Score, JaccardIndex) now share one normalization/update path
  • Re-written outdated README

Specification

None / not applicable

Dependencies & Potential Impact

None / not applicable

Deployment Plan

None / not applicable

Testing & Validation

None / not applicable

AI Usage

Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]

Submitted code was reviewed by a human: YES/NO

The author is taking the responsibility for the contribution: YES/NO

@dtronmans
dtronmans marked this pull request as draft August 14, 2026 08:23
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c0b2cd7-ca91-4520-8d43-e77f19fdb33d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dtronmans
dtronmans marked this pull request as ready for review August 17, 2026 10:51
@dtronmans
dtronmans requested a review from klemen1999 August 19, 2026 08:02

@klemen1999 klemen1999 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

At the moment I'm still a bit undecided about this new Predictions class because it technically closes down the range of supported tasks. Because if let's say I want to evaluate an OCR model the current Predictions doesn't support it so technically I'm breaking contract even though my custom parser and custom metrics that I registered can work with this custom message type. I'll think a bit more before I propose some changes.
Generally I'd like to keep luxonis-eval as a lightweight framework that doesn't enforce some contracts unless it really has to. And the interesting part is finding the right balance.

Comment thread luxonis_eval/core/core.py
report = make_report_table(
engine_name=engine_name,
result = EvaluationResult(
evaluator_name=self.evaluator_cfg.name,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

self.evaluator_cfg.name is optional config item. So we should have a fallback since EvaluationResult expects string. We can have either empty string or if you can think of any other logical fallback string

pct = (ms / total * 100.0) if total else 0.0
return f"{ms:5.2f} ms | {pct:4.1f}%"
def _format_stage_latency(name: str, throughput: ThroughputResult) -> str:
ms = float(getattr(throughput, f"{name}_ms_per_sample"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why getattr here?

Comment on lines +10 to +22
class ThroughputResult:
"""End-to-end throughput and latency measurements."""

elapsed_s: float
samples: int
samples_per_s: float
ms_per_sample: float
overhead_ms_per_sample: float
inference_ms_per_sample: float
parsing_ms_per_sample: float
metric_update_ms_per_sample: float
metric_compute_ms_per_sample: float

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just a note: This will likely completely change when we introduce proper benchmarking but yeah, we can have it like this for the v0.1.0 of lux-eval

Comment on lines +31 to +36
"""Extract a semantic-segmentation mask from a prediction payload."""
if hasattr(predictions, "getCvMask"):
mask = predictions.getCvMask()
elif hasattr(predictions, "getCvSegmentationMask"):
mask = predictions.getCvSegmentationMask()
else:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We shouldn't need this fallback right since we are locked to a dai-nodes (and dai) that only have one of these as valid

@@ -0,0 +1,125 @@
from dataclasses import dataclass
from typing import Mapping

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Linter suggestion: Import from collections.abc instead: Mapping

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