feat(cli): reach DLC-project import and COCO seg/identity options from convert#496
Open
talmo wants to merge 1 commit into
Open
feat(cli): reach DLC-project import and COCO seg/identity options from convert#496talmo wants to merge 1 commit into
talmo wants to merge 1 commit into
Conversation
…m convert Extend `sio convert` (and CLI format inference) to reach two 0.8.0 readers that were previously Python-only. DLC project import: `_infer_input_format` now detects a DeepLabCut project (a directory containing config.yaml + labeled-data/, or a standalone project config.yaml validated by content) and returns a new `dlc_project` format. `dlc_project` is added to INPUT_FORMATS so `--from dlc_project` is accepted. A plain DLC CSV is still detected as `dlc`, and an unrelated config.yaml is not misclassified. COCO options: `convert` gains `--coco-category-as-track` and `--coco-segmentation [mask|roi]`, forwarded into the COCO loader when the input format is coco. Defaults match the Python API (category_as_track=False, segmentation_format="mask"). Docs (cli.md) document the new options, the dlc_project format, and the detection rules. Tests cover detection (directory + config.yaml + non-DLC config), DLC-project convert (auto + explicit --from), and COCO convert with options vs defaults. Note: `sio show <dlcproject>` additionally requires #488 (adds **kwargs to dlc.load_dlc_project) and is intentionally not exercised here. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YHwWuvFdH5W539AgSjuTxV
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #496 +/- ##
=======================================
Coverage 92.97% 92.97%
=======================================
Files 54 54
Lines 19444 19457 +13
Branches 4395 4399 +4
=======================================
+ Hits 18078 18091 +13
Misses 651 651
Partials 715 715 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Docs Preview
Changed pages: API changes detected - View API Reference This preview will be removed when the PR is closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes two related medium CLI-gap findings by extending
sio convert(and CLI format inference) to reach two 0.8.0 readers that were previously Python-only.Finding A: DLC project import unreachable from the CLI
_infer_input_formatreturnedNonefor a DeepLabCut project directory andconfig.yaml, sosio convert <dir>failed with "Cannot infer input format", and--from dlcon aconfig.yamlmisrouted to the single-CSV DLC reader.Fix:
_infer_input_formatnow detects a DLC project — a directory containing bothconfig.yamlandlabeled-data/, or a standaloneconfig.yamlthat validates as a DLC project config (via the existingdlc._is_dlc_project_path) — and returns a newdlc_projectformat.dlc_projectadded toINPUT_FORMATSso--from dlc_projectis accepted.dlc; an unrelatedconfig.yamlis not misclassified.sio convert <dlcproject>works end to end viaload_file(convert does not passopen_videosfor non-slp inputs).Finding B: COCO category_as_track / segmentation_format not reachable from convert
The #479 identity-track feature and ROI mode were Python-only because
convertbuiltload_kwargswith onlyformat(+open_videosfor slp).Fix:
convertgains--coco-category-as-track(flag) and--coco-segmentation [mask|roi], forwarded into the COCO loader when the input format iscoco. Defaults match the Python API (category_as_track=False,segmentation_format="mask").Testing
tests/io/test_cli.py:config.yaml, and a non-DLCconfig.yaml(returnsNone).sio convert <dlcproject>auto-detected, and explicit--from dlc_projecton aconfig.yaml; both write frames.--coco-category-as-track --coco-segmentation roi(identity tracks + vector ROIs) vs defaults (rasterized masks, no tracks).Each new-feature test fails on
mainand passes with the fix (verified by stashingcli.py). Lint clean (ruff format+ruff check); docs rebuilt withmkdocs build.Notes
sio show <dlcproject>additionally requires the separate open PR fix(dlc): accept benign loader kwargs in DLC project/splits loaders #488 (fix/dlc-loader-kwargs, adds**kwargstodlc.load_dlc_projectso show'sopen_videos/lazykwargs are tolerated). That fix is not onmain, so this PR intentionally does not testsio show <dlcproject>.cli.pyis also edited by sibling CLI PRs; edits here are localized to_infer_input_format,INPUT_FORMATS, and theconvertcommand to minimize merge conflicts.🤖 Generated with Claude Code
https://claude.ai/code/session_01YHwWuvFdH5W539AgSjuTxV