label tool rework and vision bugs fix - #161
Merged
SimoneMartino98 merged 28 commits intoSep 3, 2026
Merged
Conversation
- Backend: stdlib HTTP server with JSON API; session autosave on disk, image/video upload (frame extraction via OpenCV), dataset export and synthetic dataset generation written directly to disk with absolute paths in dataset.yaml, fully compatible with VisionInstance. - Stable YOLO class IDs from the label list order; every image gets a label file and every class appears in dataset.yaml. - New canvas-based frontend: box draw/select/move/resize/delete, zoom and pan, video import, drag & drop, export/synthesize dialogs, no CDN dependencies; page reload no longer kills the server. - Add pytest coverage for workspace, export, synthesize and HTTP API. - Update docs and screenshot. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Progress bars for every long operation: image uploads (per-file), video upload (byte-level) and frame extraction, dataset export and synthesis (server-side progress polled via /api/progress). - Replace the text brand with the dynsight logo in the top bar. - Sessions are no longer saved to disk automatically: edits are only mirrored to server memory (/api/sync). Saving requires an explicit file path via the Save session dialog; Load restores a saved file; quitting with unsaved changes asks whether to save first. - Fix sidebar panel collapse with long image lists; topbar wraps on narrow windows. - Update tests and docs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- If a project-local ./.venv exists, its tools are used automatically (no activation needed); otherwise the active environment (e.g. conda) is used. - just dev autodetects the installer: uv into ./.venv when available, pip inside an active conda env, plain pip as fallback; on macOS it also clears the hidden flag on .pth files, which Python >= 3.11 silently skips. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- lens.py: numba prange loops are not understood by mypy; silence the false-positive attr-defined errors. - vision.py: newer ultralytics annotates predict() with a wider return union; cast to list[Results] (always true without stream=True). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- The check recipe used 'trap error=1 ERR', which bash 3.2 (the macOS default shell) never runs for a failing subshell: a failing step left the exit code at 0, so broken checks looked green. Failures are now collected explicitly and the failing steps are listed. - Import the package from ./src via PYTHONPATH. The editable install relies on a .pth file that Python >= 3.11 skips when it carries the macOS 'hidden' flag, which some setups keep re-applying to the venv. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
just dev now installs into whichever project venv exists instead of always assuming ./.venv, so a venv named ./venv is not silently bypassed (and recreated as ./.venv). On macOS some setups keep marking dot-directories as hidden, which makes Python skip the .pth file of the editable install; a venv named ./venv avoids that entirely. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- ruff 0.16 promoted new rules that 'select = ALL' picks up: ignore CPY001 (the licence lives in LICENSE, not in every file header) and PLR0917 (positional-argument counterpart of the already ignored PLR0913), and move None to the end of the unions flagged by RUF036. - mypy skips dot-directories, so a project venv named ./venv was being type checked; exclude it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
track_xyz always read the input as '<name> <x> <y> <z>', so files written as '<x> <y> <z>' (a layout its own docstring documents) ended up with no positions at all and were rejected as malformed. The column layout is now taken from the first atom line of the file. The name column is also always written to the output: without it the resulting file was not a readable .xyz, and reading it back shifted the coordinates by one column. Objects with no name in the input get the placeholder name 'C'. Closes GMPavanLab#150 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Backend: stdlib HTTP server with JSON API; session autosave on disk, image/video upload (frame extraction via OpenCV), dataset export and synthetic dataset generation written directly to disk with absolute paths in dataset.yaml, fully compatible with VisionInstance. - Stable YOLO class IDs from the label list order; every image gets a label file and every class appears in dataset.yaml. - New canvas-based frontend: box draw/select/move/resize/delete, zoom and pan, video import, drag & drop, export/synthesize dialogs, no CDN dependencies; page reload no longer kills the server. - Add pytest coverage for workspace, export, synthesize and HTTP API. - Update docs and screenshot.
- Progress bars for every long operation: image uploads (per-file), video upload (byte-level) and frame extraction, dataset export and synthesis (server-side progress polled via /api/progress). - Replace the text brand with the dynsight logo in the top bar. - Sessions are no longer saved to disk automatically: edits are only mirrored to server memory (/api/sync). Saving requires an explicit file path via the Save session dialog; Load restores a saved file; quitting with unsaved changes asks whether to save first. - Fix sidebar panel collapse with long image lists; topbar wraps on narrow windows. - Update tests and docs.
- If a project-local ./.venv exists, its tools are used automatically (no activation needed); otherwise the active environment (e.g. conda) is used. - just dev autodetects the installer: uv into ./.venv when available, pip inside an active conda env, plain pip as fallback; on macOS it also clears the hidden flag on .pth files, which Python >= 3.11 silently skips.
- lens.py: numba prange loops are not understood by mypy; silence the false-positive attr-defined errors. - vision.py: newer ultralytics annotates predict() with a wider return union; cast to list[Results] (always true without stream=True).
- The check recipe used 'trap error=1 ERR', which bash 3.2 (the macOS default shell) never runs for a failing subshell: a failing step left the exit code at 0, so broken checks looked green. Failures are now collected explicitly and the failing steps are listed. - Import the package from ./src via PYTHONPATH. The editable install relies on a .pth file that Python >= 3.11 skips when it carries the macOS 'hidden' flag, which some setups keep re-applying to the venv.
just dev now installs into whichever project venv exists instead of always assuming ./.venv, so a venv named ./venv is not silently bypassed (and recreated as ./.venv). On macOS some setups keep marking dot-directories as hidden, which makes Python skip the .pth file of the editable install; a venv named ./venv avoids that entirely.
- ruff 0.16 promoted new rules that 'select = ALL' picks up: ignore CPY001 (the licence lives in LICENSE, not in every file header) and PLR0917 (positional-argument counterpart of the already ignored PLR0913), and move None to the end of the unions flagged by RUF036. - mypy skips dot-directories, so a project venv named ./venv was being type checked; exclude it.
track_xyz always read the input as '<name> <x> <y> <z>', so files written as '<x> <y> <z>' (a layout its own docstring documents) ended up with no positions at all and were rejected as malformed. The column layout is now taken from the first atom line of the file. The name column is also always written to the output: without it the resulting file was not a readable .xyz, and reading it back shifted the coordinates by one column. Objects with no name in the input get the placeholder name 'C'. Closes GMPavanLab#150
…artino98/dynsight into vision/label-tool-rework
SimoneMartino98
commented
Aug 27, 2026
SimoneMartino98
commented
Aug 27, 2026
All four surfaced while writing hands-on tutorials against the public API. Regression tests for each are in tests/test_regressions.py. - orientational_order_param() and velocity_alignment() looped over the full universe trajectory while the neighbour list only covered the slice, so they raised IndexError on any Trj built with with_slice(). Both now take a trajslice argument, which Trj forwards, and a mismatched neighbour list raises a clear ValueError instead. - spatialaverage() indexed the descriptor with the trajectory's frame count. Descriptors defined on pairs of frames (LENS, timeSOAP) are one frame shorter, so passing the unsliced Trj gave a bare IndexError from inside a worker process. The frame counts are now checked up front. - compute_lens() inferred a box from the coordinate bounding box when the universe has none. A planar system - anything coming out of dynsight.vision - has zero extent along z, and the zero-length box side made the cell-list construction divide by zero. Every side is now padded by r_cut, as list_neighbours_along_trajectory already did. - track_xyz() returned a Trj built on a file whose frames may hold different numbers of objects, which is not a readable trajectory: it raised EOFError on the first descriptor. It now returns None, logging the min and max object count, when no trajectory exists. The output file is still written in both cases.
A tracked file holds one line per detection, so its frames rarely hold the same objects: returning a Trj only for the clean case made the function unusable in practice. track_xyz now just writes the tracked file, and the caller decides whether the result can become a Trj. The warning about a varying object count is kept as a diagnostic. Also align two tests left behind by earlier commits (the spatial average message and the default object name), reflow an over-long line in spatial_average.py, and keep a local build/ directory out of mypy.
tests/test_regressions.py grouped tests by the moment their bugs were found rather than by subject, which hid them from whoever works on a module. Each test now lives in the file of its own feature: - slicing of Trj descriptors -> tests/trajectory/test_trj.py - spatialaverage frame mismatch -> tests/analysis/test_spatialaverage.py - LENS on planar data -> tests/lens/test_lens.py - track_xyz output -> tests/track/test_track.py The shared trajectory is now a fixture in the two files that need it.
SimoneMartino98
marked this pull request as ready for review
September 1, 2026 13:55
ChiaraLionello
requested changes
Sep 2, 2026
ChiaraLionello
left a comment
Collaborator
There was a problem hiding this comment.
Few chances in the documentation are suggested, but I think it's ok
| exploits the power of the `YOLO models <https://docs.ultralytics.com/models/yolo12/>`_ | ||
| for computer vision tasks. Thus, the ``label_tool`` has been specifically | ||
| designed to work with the YOLO dataset format. | ||
| for computer vision tasks. Thus, the ``label_tool`` writes datasets directly |
Collaborator
There was a problem hiding this comment.
I would remove "Thus," and start directly with "The label_tool..."
| boxes. | ||
|
|
||
| .. image:: ../_static/label_bar.png | ||
| Annotating is done directly on the canvas: |
Collaborator
There was a problem hiding this comment.
Annotations are done directly on the canvas:
| The Graphical User Interface is divided in three main panels: | ||
|
|
||
| * **The label menu panel**: where labels can be created and edited. | ||
| * **The labels panel** (top left): create the object classes. Each label |
Collaborator
There was a problem hiding this comment.
Maybe "labels" here and "images" below can be written in capital letters as are the proper names of the panels
ChiaraLionello
approved these changes
Sep 3, 2026
SimoneMartino98
added a commit
that referenced
this pull request
Sep 3, 2026
label tool rework and vision bugs fix
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.
Hi all, I’m preparing this for the next dynsight hands-on (11 September 2026). We already knew that vision and label_tools had some issues working together, so in this PR I’m fixing everything.
The
label_toolGUI has been rewritten from scratch, and its output is nowdirectly usable by
VisionInstancewithout any manual fix-up.What changed
(not only "clear last/all"); zoom and pan; drag & drop; video import with
frame extraction; progress bars for every long operation.
pathindataset.yaml, soset_training_dataset()accepts them as they are.the order in which annotations happen to be met during the export.
file chosen by the user, and can be loaded back. Quitting with unsaved
changes asks first.
CDN script is gone, so the tool also works offline).
Bugs fixed
dataset.yamlno longer needs to be edited by hand after the export.track_xyznow accepts.xyzfiles without the atom name column (closes track_xyz is not working with name less xyz formats. #150).