Skip to content

Filter image list by annotation status (#27) + CPU fallback for unsupported CUDA GPUs (#57)#71

Merged
bnsreenu merged 2 commits into
bnsreenu:masterfrom
cofade:feature/upstream-issue-27-57
Jun 25, 2026
Merged

Filter image list by annotation status (#27) + CPU fallback for unsupported CUDA GPUs (#57)#71
bnsreenu merged 2 commits into
bnsreenu:masterfrom
cofade:feature/upstream-issue-27-57

Conversation

@cofade

@cofade cofade commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Hi @bnsreenu — this PR resolves two open issues. Each feature is its own commit, and the diff is scoped to just these two changes (plus tests and arc42 doc updates).

Closes #27 — Filter image list by annotation status

Adds a combo box above the image list with All images / Without annotations / With annotations.

  • Rows are hidden via setRowHidden, never removed — this keeps row-index iteration valid (DINO batch navigation, COCO import) and fires no spurious currentRowChangedswitch_image.
  • A non-matching image is hidden even while selected; hiding doesn't touch current_image, so the canvas keeps showing the worked-on image while its row leaves the list.
  • Multi-dim images count as annotated when any of their slices has annotations.
  • Re-apply hooks into ClassController.update_slice_list_colors, which every annotation-mutation path already reaches.

(The arrow-key navigation half of #27 already works in current master.)

Closes #57 — CPU fallback for unsupported CUDA compute capability

torch.cuda.is_available() returns True for Pascal GPUs (e.g. GTX 1050, sm_61) even though torch ≥ 2.8 wheels ship sm_70+ kernels only — so inference died with CUDA error: no kernel image is available.

  • New core/torch_utils.resolve_torch_device() compares the device's compute capability against torch.cuda.get_arch_list() and falls back to CPU with an actionable warning (cached process-wide).
  • Wired into SAM (device= on every predict), DINO (_resolve_device, DINO_DEVICE override preserved), and YOLO train/predict.
  • One-time QMessageBox warning at SAM model pick / DINO detect, plus a README note with the torch-downgrade command for users who want to keep GPU inference.

Testing

  • 141 tests pass (26 new: filter unit tests, torch_utils unit tests with a fake torch module, and an end-to-end filter-wiring test through a full ImageAnnotator).
  • Verified the device helper returns CPU + warning for a simulated sm_61 GPU and CUDA for supported cards.

Happy to adjust naming or split further if you'd prefer.

cofade and others added 2 commits June 19, 2026 23:23
Adds a combo above the image list (All / Without annotations / With
annotations). Rows are hidden via setRowHidden — never removed — so
row-index iteration (DINO batch navigation, COCO import) stays valid
and no spurious currentRowChanged/switch_image fires. A non-matching
current row is hidden too; hiding does not change current_image, so the
canvas keeps showing the worked-on image while its row leaves the list.
Multi-dim images count as annotated when any slice has annotations.
Re-apply hooks into ClassController.update_slice_list_colors, which
every annotation-mutation site already reaches.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nu#57)

torch.cuda.is_available() is True for Pascal GPUs (e.g. GTX 1050,
sm_61) even though torch>=2.8 wheels ship sm_70+ kernels only, so every
launch died with 'CUDA error: no kernel image is available'. New
core/torch_utils.resolve_torch_device() compares the device capability
against torch.cuda.get_arch_list() and returns cpu + an actionable
warning on mismatch (cached process-wide). SAM passes device= on every
predict, DINO's _resolve_device delegates to the helper (DINO_DEVICE
override kept), YOLO train/predict pass device=. One-time QMessageBox
via maybe_warn_cpu_fallback at SAM model pick and DINO detect. README
gains a Pascal/Maxwell note with the torch-downgrade command. arc42
docs updated for both features.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bnsreenu bnsreenu merged commit e50826c into bnsreenu:master Jun 25, 2026
12 checks passed
bnsreenu pushed a commit that referenced this pull request Jun 25, 2026
- #30: save trained YOLO model with model.save() not model.export()
- #44: open all text files (YAML/JSON/TXT, incl. .iap project) as UTF-8
  to prevent the Windows cp1252 'charmap' crash
- #33: edit the smallest containing polygon so nested annotations are
  reachable (reuses shoelace calculate_area)
- #60: sort the image list alphabetically via a signals-blocked
  model+view rebuild (not setSortingEnabled), preserving the
  all_images[i] <-> image_list.item(i) invariant
- #56: add imagecodecs dependency and catch the LZW/compressed-TIFF
  ValueError with an actionable dialog instead of crashing

Stacked on the #27/#57 branch (PR #71) because #60/#56 build on the
image-list filter work. 157 tests pass; ruff F,E9 clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cofade cofade deleted the feature/upstream-issue-27-57 branch June 26, 2026 08:25
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.

CUDA kernel error: GTX 1050 (sm_61) not supported by PyTorch 2.8 wheels image filtering suggestion

2 participants