Skip to content

288 data tags export to labelling integration - #293

Open
guillaume-byte wants to merge 8 commits into
devfrom
288-data-tags-export-to-labelling-integration
Open

288 data tags export to labelling integration#293
guillaume-byte wants to merge 8 commits into
devfrom
288-data-tags-export-to-labelling-integration

Conversation

@guillaume-byte

@guillaume-byte guillaume-byte commented Aug 14, 2026

Copy link
Copy Markdown
Member

Allow the user to export tagged data for Review with export formats including CVA, v7 Darwin, and Label Studio.
From SDK: wl.export_annotations
From CLI: weightslab export -f cvat --tag ToReview
From UI: Export button

guillaume-byte and others added 2 commits August 14, 2026 15:39
* Add automatic resource monitoring (CPU/memory/disk/network/GPU/process)

Background daemon thread, started alongside the watchdog in grpc_serve(),
samples system and process resource usage on a wall-clock interval and
logs each metric through the existing signal pipeline so it shows up in
Weights Studio like any other loss/metric curve. GPU metrics use NVML
(nvidia-ml-py) and degrade gracefully with no NVIDIA driver present.

Enabled by default; configurable/disableable via env vars or a new
resource_monitoring.yaml (per-category toggles), documented in
docs/resource_monitoring.rst and docs/configuration.rst.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add annotation export to CVAT / Label Studio / V7 (Darwin) formats

New weightslab.export package collects bounding boxes and segmentation
masks (converted to polygons via OpenCV, optional weightslab[export]
extra) from the registered dataframe into a format-agnostic
representation, then encodes it to one of three relabeling-tool formats.
Bounding-box export needs no extra dependency.

Wired through three equally-weighted entry points sharing the same core
logic:
- Python API: wl.export_annotations(fmt, path=None, origin=None, ...)
- CLI: `weightslab export --format {cvat,label_studio,v7} [OUTPUT]`,
  connecting over gRPC like `weightslab cli`
- gRPC: new ExportAnnotations RPC (experiment_service.proto), delegated
  to DataService -- this backs the Weights Studio "Export" button
  (frontend change tracked separately in weights_studio)

Class names and image paths/dimensions have no dedicated registry in the
current data model, so both are resolved best-effort (explicit override,
then dataset.class_names / common path attributes, then a synthetic
filename) -- documented explicitly in docs/export.rst so silent
mismatches aren't a surprise.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Include ubuntu compatible annotations export formating for solutions like CVAT, v&, ..etc.

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* Add automatic resource monitoring (CPU/memory/disk/network/GPU/process)

Background daemon thread, started alongside the watchdog in grpc_serve(),
samples system and process resource usage on a wall-clock interval and
logs each metric through the existing signal pipeline so it shows up in
Weights Studio like any other loss/metric curve. GPU metrics use NVML
(nvidia-ml-py) and degrade gracefully with no NVIDIA driver present.

Enabled by default; configurable/disableable via env vars or a new
resource_monitoring.yaml (per-category toggles), documented in
docs/resource_monitoring.rst and docs/configuration.rst.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add annotation export to CVAT / Label Studio / V7 (Darwin) formats

New weightslab.export package collects bounding boxes and segmentation
masks (converted to polygons via OpenCV, optional weightslab[export]
extra) from the registered dataframe into a format-agnostic
representation, then encodes it to one of three relabeling-tool formats.
Bounding-box export needs no extra dependency.

Wired through three equally-weighted entry points sharing the same core
logic:
- Python API: wl.export_annotations(fmt, path=None, origin=None, ...)
- CLI: `weightslab export --format {cvat,label_studio,v7} [OUTPUT]`,
  connecting over gRPC like `weightslab cli`
- gRPC: new ExportAnnotations RPC (experiment_service.proto), delegated
  to DataService -- this backs the Weights Studio "Export" button
  (frontend change tracked separately in weights_studio)

Class names and image paths/dimensions have no dedicated registry in the
current data model, so both are resolved best-effort (explicit override,
then dataset.class_names / common path attributes, then a synthetic
filename) -- documented explicitly in docs/export.rst so silent
mismatches aren't a surprise.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix monitoring step to model age

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 14:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds two user-facing capabilities to WeightsLab’s backend: (1) exporting tagged annotations to common labeling-tool formats via a new gRPC endpoint (surfaced through the Python API and CLI), and (2) always-on system/process resource monitoring that logs CPU/memory/disk/network/GPU metrics as Studio-visible signals.

Changes:

  • Added ExportAnnotations gRPC API + backend handler, plus weightslab export CLI and wl.export_annotations() Python API.
  • Introduced an annotation export pipeline (IR models, dataframe collection, format encoders for CVAT / Label Studio / V7).
  • Added a background resource monitor with YAML/env configuration, plus documentation and tests.

Reviewed changes

Copilot reviewed 37 out of 40 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
weightslab/trainer/trainer_services.py Wires ExportAnnotations RPC delegation and starts resource monitor alongside the server lifetime.
weightslab/trainer/services/data_service.py Implements ExportAnnotations handler and maps proto enum → exporter format keys.
weightslab/src.py Adds wl.export_annotations() Python API wrapper for writing exports to disk.
weightslab/proto/experiment_service.proto Adds ExportAnnotations RPC and request/response messages + format enum.
weightslab/proto/experiment_service_pb2.py Regenerated protobuf Python stubs to include export RPC/messages.
weightslab/proto/experiment_service_pb2_grpc.py Regenerated gRPC stubs to include ExportAnnotations methods.
weightslab/monitoring/resource_monitor.py New resource-monitor implementation (thread, samplers, config resolution, singleton).
weightslab/monitoring/init.py Exposes monitoring public API symbols.
weightslab/export/models.py New intermediate representation (IR) dataclasses for exported annotations.
weightslab/export/collect.py Collects annotations from the ledger dataframe into IR (boxes/polygons, tag filtering).
weightslab/export/exporter.py Dispatches IR → encoded bytes, and persists export payloads to disk.
weightslab/export/formats/cvat.py CVAT XML encoder.
weightslab/export/formats/label_studio.py Label Studio JSON encoder.
weightslab/export/formats/v7_darwin.py V7/Darwin JSON encoder (zipped per-image files).
weightslab/export/init.py Export package public API surface.
weightslab/examples/PyTorch/wl-detection-relabeling/utils/data.py New example dataset utilities (download + detection dataset).
weightslab/examples/PyTorch/wl-detection-relabeling/main.py New example entrypoint for tagging + exporting without a training loop.
weightslab/examples/PyTorch/wl-detection-relabeling/config.yaml Example configuration for serving + dataset.
weightslab/examples/PyTorch/wl-detection-relabeling/README.md Example documentation for the relabeling workflow.
weightslab/cli.py Adds weightslab export command and CLI-side gRPC export client.
weightslab/init.py Exposes export_annotations in the top-level package API list.
tests/trainer/services/test_trainer_services_unit.py Unit tests for DataService.ExportAnnotations.
tests/trainer/services/test_trainer_services_server.py Ensures servicer delegates ExportAnnotations.
tests/monitoring/test_resource_monitor.py Unit tests for monitoring config/lifecycle/sampling/singleton behavior.
tests/general/test_cli_export.py Tests for weightslab export CLI behavior.
tests/export/test_formats.py Encoder tests for CVAT / Label Studio / V7 output structure.
tests/export/test_exporter.py Dispatcher + save-to-disk tests.
tests/export/test_collect.py Collector tests (bbox/mask heuristics, tag filtering, end-to-end with mocked dataframe).
tests/backend/test_export_annotations_api.py Tests for wl.export_annotations wrapper behavior and path resolution.
resource_monitoring.yaml Default resource-monitoring configuration file added at repo root.
pyproject.toml Adds psutil and nvidia-ml-py core deps; adds export extra for OpenCV headless.
docs/user_functions.rst Documents wl.export_annotations.
docs/user_commands.rst Documents weightslab export CLI.
docs/resource_monitoring.rst New monitoring documentation.
docs/index.rst Adds docs nav entries for resource monitoring and annotation export.
docs/export.rst New annotation export documentation.
docs/configuration.rst Adds resource monitoring env-var documentation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread weightslab/export/collect.py
Comment thread weightslab/export/collect.py Outdated
Comment thread weightslab/monitoring/resource_monitor.py
Comment thread weightslab/cli.py
Comment thread weightslab/cli.py Outdated
Comment thread weightslab/examples/PyTorch/wl-detection-relabeling/utils/data.py
Comment thread weightslab/export/exporter.py Outdated
guillaume-byte and others added 6 commits August 14, 2026 17:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@guillaume-byte
guillaume-byte enabled auto-merge (squash) August 14, 2026 15:30
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