Skip to content

fix(robot-cityscapes-synthia): fix three Sedna interface crashes blocking all pipeline runs#567

Open
rajdhruvsingh wants to merge 5 commits into
kubeedge:mainfrom
rajdhruvsingh:fix/robot-cityscapes-synthia-runtime-crashes
Open

fix(robot-cityscapes-synthia): fix three Sedna interface crashes blocking all pipeline runs#567
rajdhruvsingh wants to merge 5 commits into
kubeedge:mainfrom
rajdhruvsingh:fix/robot-cityscapes-synthia-runtime-crashes

Conversation

@rajdhruvsingh

Copy link
Copy Markdown

What type of PR is this?
/kind bug
/kind failing-test

What this PR does / why we need it:
Fixes three runtime crashes that blocked every training and evaluation run of
the robot-cityscapes-synthia lifelong learning example when using Sedna 0.6.0.1.

Bug 1 — task_allocation_by_domain.py: wrong call signature
Sedna instantiates TaskAllocationByOrigin(task_extractor=..., **kwargs) then
calls method(samples=samples). The old call expected task_extractor as a
positional argument and crashed immediately. Moved task_extractor to init
and stored as self.task_extractor.

Bug 2 — cityscapes.py: NoneType has no len() during inference
data.y is None when Sedna runs inference (no ground-truth labels available).
The old code assigned self.labels[split] = data.y unconditionally, then later
called self.labels[split][index].rstrip() which crashed. Added an explicit
data is None guard and a safe data.y is not None check before accessing labels.

Bug 3 — cityscapes.py: ValueError: truth value of array is ambiguous
data.y from Sedna is a numpy array. Bare truthiness checks like if data: or
data else None on a multi-element numpy array raise this error. Replaced all
such checks with isinstance() and hasattr() guards throughout init.

All three fixes verified with an isolated mock test against Sedna 0.6.0.1
BaseDataSource, covering train (with labels), inference (labels=None), and
numpy array label inputs.

Which issue(s) this PR fixes:
Fixes #473
Related to #230

Adds parallel execution of test cases to address the unbearable
time overhead when testing multiple hyperparameter groups
sequentially (issue 8).

Changes:
- testcasecontroller.py: add parallel/max_workers params to
  run_testcases(), add _run_testcases_sequential() and
  _run_testcases_parallel() using ThreadPoolExecutor
- testcase.py: fix race condition in _get_output_dir() using
  os.makedirs(exist_ok=True) instead of os.path.exists() loop
- benchmarkingjob.py: add parallel and max_workers config fields
- docs/proposals/chore/parallel_testcase_execution.md: RFC
  proposing phased approach (ThreadPoolExecutor now, Sandbox
  Engine future per PR 526)

ThreadPoolExecutor chosen over ProcessPoolExecutor to avoid
pickling issues with ML model objects. Parallel execution is
opt-in via benchmarkingjob.yaml (parallel: false by default)
for full backward compatibility.

Signed-off-by: dhruvraj319 <dhruv.raj319@gmail.com>
- Remove manual worker count default to avoid OOM on large
  test suites — let ThreadPoolExecutor use its own safe default
- Fix type annotation: max_workers: int | None = None
- Add YAML string coercion for parallel and max_workers params
  to handle parallel: 'false' string values correctly
- Deep copy test cases in parallel mode to prevent race
  conditions from shared test_env and dataset state

Signed-off-by: dhruvraj319 <dhruv.raj319@gmail.com>
…multiedge_inference_bench

- fix(447): guard np.nonzero()[0][0] in rank_1/2/5.py to skip queries
  with no gallery match instead of raising IndexError
- fix(447): replace RuntimeError in mAP.py with LOGGER.warning + return 0.0
  so the pipeline degrades gracefully on empty query sets
- fix(449): add requirements.txt with all missing dependencies (loguru,
  motmetrics, mmcv, opencv-python) and version bounds (motmetrics>=1.2.0,
  pandas<2.0)
- fix(449): replace Docker-only absolute workspace path /ianvs/... with
  relative path ./workspace/... in tracking_job.yaml and reid_job.yaml
- fix(450): move top-level 'import onnx' to lazy import inside _partition()
  so non-partitioning users (MOT17 example) are not forced to install onnx

Signed-off-by: dhruvraj319 <dhruv.raj319@gmail.com>
@kubeedge-bot kubeedge-bot added kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. labels Jun 27, 2026
@kubeedge-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rajdhruvsingh
To complete the pull request process, please assign jaypume after the PR has been reviewed.
You can assign the PR to them by writing /assign @jaypume in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot kubeedge-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 27, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces parallel test case execution using ThreadPoolExecutor to reduce benchmarking time, fixes a directory creation race condition, and updates various examples, requirements, and datasets for better robustness. The review feedback highlights critical parameter order mismatches in the mAP and rank_* metric signatures, which swap ground truth and predictions. Additionally, the feedback points out a correctness issue in the CMC calculation denominator for rank_1, rank_2, and rank_5, where skipped queries with no gallery matches are incorrectly included in the total count, artificially lowering the scores.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@kubeedge-bot kubeedge-bot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jun 27, 2026
@rajdhruvsingh rajdhruvsingh force-pushed the fix/robot-cityscapes-synthia-runtime-crashes branch from b06e27a to 2cc9cf5 Compare June 27, 2026 03:37
@kubeedge-bot kubeedge-bot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jun 27, 2026
- fix(447): guard np.nonzero()[0][0] in rank_1/2/5.py to skip queries
  with no gallery match instead of raising IndexError
- fix(447): fix CMC denominator — divide by valid_queries (queries with
  at least one gallery match) instead of m (all queries), fixing
  artificial underestimation of rank-1/2/5 scores
- fix(447): replace RuntimeError in mAP.py with LOGGER.warning + return 0.0
  so the pipeline degrades gracefully on empty query sets
- fix(449): add requirements.txt with all missing dependencies (loguru,
  motmetrics, mmcv, opencv-python) and version bounds (motmetrics>=1.2.0,
  pandas<2.0)
- fix(449): replace Docker-only absolute workspace path /ianvs/... with
  relative path ./workspace/... in tracking_job.yaml and reid_job.yaml
- fix(450): move top-level 'import onnx' to lazy import inside _partition()
  so non-partitioning users (MOT17 example) are not forced to install onnx

Signed-off-by: dhruvraj319 <dhruv.raj319@gmail.com>
…ask_allocation and cityscapes dataset

Bug 1: TaskAllocationByOrigin.__call__() expected task_extractor as a
parameter but Sedna passes it to __init__() and calls method(samples=samples).
Moved task_extractor to __init__, removed it from __call__ signature.

Bug 2: CityscapesSegmentation.__init__() crashed with 'NoneType has no len()'
when data is a BaseDataSource. Added explicit hasattr(data, 'x') guard,
None check on data.y for inference phase, and clear ValueError when data=None.

Bug 3: Bare truthiness checks on numpy arrays (data.y from Sedna BaseDataSource)
raised 'ValueError: truth value of array is ambiguous'. Replaced all such
checks with isinstance() and hasattr() guards throughout.

Fixes 473
Related to 230

Signed-off-by: dhruvraj319 <dhruv.raj319@gmail.com>
@rajdhruvsingh rajdhruvsingh force-pushed the fix/robot-cityscapes-synthia-runtime-crashes branch from 2cc9cf5 to 1fe9479 Compare June 27, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] task_allocation_by_domain.py and cityscapes.py crash at runtime due to Sedna interface and type mismatches in robot-cityscapes-synthia example

2 participants