s6.app.data package¶
Submodules¶
s6.app.data.collect module¶
Collect a random-sweep dataset of synchronized camera frames.
Moves servos randomly within a circular region and captures live camera
snapshots via HTTP streaming. Stores each frame in a
s6.utils.StructuredDataset with camera ordering resolved by
hardware IDs.
Examples
Collect 100 frames with a 5.0 radius and save to a folder:
>>> python -m s6.app.data.collect -n 100 -r 5.0 ... --waypoint center -o data/random_dataset
- s6.app.data.collect.main()¶
Run servo random sweep and capture synchronized snapshots.
- s6.app.data.collect.parse_args()¶
Parse CLI arguments for random sweep capture.
s6.app.data.convert module¶
Convert a structured annotation dataset into YOLO format.
Class labels correspond to vertex names (one bounding box per projected
vertex). Reads annotation.jsonl and images from the input directory,
generates train/val splits, copies images to images/{train,val},
writes YOLO label files, and creates data.yaml for Ultralytics
YOLO training.
Examples
>>> python -m s6.app.data.convert -i ./dataset1 -o ./dataset1_yolo --val-ratio 0.2
- s6.app.data.convert.collect_classes(ann_file)¶
Collect ordered class names from vertex labels appearing in frames.
- s6.app.data.convert.load_annotations(ann_file)¶
Yield parsed InstrumentTrackingFrame entries from a JSONL file.
- s6.app.data.convert.main()¶
Run the conversion and write YOLO dataset structure to output.
- s6.app.data.convert.parse_args()¶
Parse CLI options for dataset conversion to YOLO format.
s6.app.data.filter module¶
Interactively filter entries in a StructuredDataset.
Displays the image at a specified datakey and overlays a tip point. Use
a/d to navigate, x to delete the current entry, and q to
quit. A zoomed crop around the keypoint is shown for precision.
- s6.app.data.filter.get_by_datakey(data, datakey)¶
Retrieve a nested value using a slash-separated datakey path.
- Parameters:
data (Mapping | object) – Nested structure (dict-like or object with attributes).
datakey (str) – Slash-separated path, e.g.,
"B/image"or"B/tip_point".
- Returns:
The resolved value.
- Return type:
Any
- s6.app.data.filter.main()¶
Open an interactive viewer to browse and prune dataset entries.
s6.app.data.instrument_render_v3 module¶
s6.app.data.list module¶
Query, count, or download dataset records via the Gateway API.
Builds a Mongo-style aggregation pipeline from simple filter expressions
and either prints matching documents, outputs a count, or downloads data
into a s6.utils.StructuredDataset.
Examples
Count all valid records with score > 0.8:
>>> python -m s6.app.data.list valid=true score>0.8 --count
Download into a local dataset directory:
>>> python -m s6.app.data.list type="instrument" -o ./out_dataset
- s6.app.data.list.main()¶
Parse filters and run query/count/download against the Gateway.
s6.app.data.render module¶
Run Blender to render instrument datasets using a bundled project.
This wrapper launches Blender in background mode with the provided
instrument_render_v3.blend and executes the bpy script
instrument_render_v3.py. Extra arguments after -- are forwarded
to the bpy script.
Examples
Render two loops, forwarding target selection to the bpy script:
>>> python -m s6.app.data.render --loop 2 -- --targets TipTool Grasper
- s6.app.data.render.main()¶
Parse CLI flags and invoke Blender with the project and bpy script.
s6.app.data.upload module¶
Upload a dataset via Gateway to a database collection.
Reads a JSONL file (data.jsonl) and associated image folders under a
dataset directory, loads each sample into memory, and uploads them to a
Gateway server database. Adds metadata fields (upload_datetime,
dataset_name, plus any custom KEY=VALUE pairs) to each record.
Examples
>>> python -m s6.app.data.upload ./data/my_dataset -n MyDataset ... -m split="train" -m tag="v1" -c ./configs/db.config.json
- s6.app.data.upload.main()¶
Load samples from disk and upload them via Gateway.
- s6.app.data.upload.parse_args()¶
Parse CLI arguments for dataset upload.
s6.app.data.visualize module¶
Preview dataset frames with annotations.
Supports two formats:
- InstrumentTrackingFrame with projections and optional boxes.
- YOLO layout under images/ and labels/ with .txt labels.
Examples
>>> python -m s6.app.data.visualize ./dataset_dir
- s6.app.data.visualize.draw_instrument_frame(img, frame: InstrumentTrackingFrame)¶
Draw instrument projections or boxes onto an image inplace.
- s6.app.data.visualize.draw_yolo_frame(img, frame: YoloFrame)¶
Draw YOLO-format boxes (xc,yc,w,h normalized) on an image inplace.
- s6.app.data.visualize.load_instrument_frames(ann_path: Path)¶
Load InstrumentTrackingFrame entries from a JSONL file.
- s6.app.data.visualize.load_yolo_frames(dataset_dir: Path)¶
Load YOLO frames from an
images/traintree with labels.
- s6.app.data.visualize.main()¶
Open an interactive viewer to step through annotated frames.