Recipe: Dataset Capture and Replay Loop

Record live gst data, replay it deterministically, and refine samples in place.

This recipe covers a practical loop for pipeline work:

  • Capture a dataset from live gstreamer cameras.

  • Replay that dataset while iterating on pipeline code.

  • Inspect or prune samples before retraining or exporting a cleaned set.


0) Prerequisites

  • s6 installed and runnable (pip install -e .).

  • Valid gstreamer client configuration for the live capture source.

  • A pipeline config under configs/ if you want repeatable replay runs.


1) Record from live cameras

Use track in record-only mode so frames are saved without running inference.

# Record from the live gst source into a dataset directory
s6 track -i gst -o ./temp/run_net_01 -r

# Add logs if you want timing and trace output for the run
s6 track -i gst -o ./temp/run_net_01 -r -x

Notes

  • -i gst uses the configured remote gstreamer camera source.

  • -o sets the dataset output directory and supports path placeholders.

  • -r/--record-only skips inference and is the fastest way to collect data.

  • -x/--output-log writes logs/runs/<timestamp>/metrics.json and perf.log.json.


2) Replay the dataset while you iterate

Point track back at the saved dataset directory. Use --repeat to loop the playback for quick iteration, and --realtime-playback when you want recorded timestamp spacing instead of maximum-speed replay.

# Headless replay, loop forever, and write logs for profiling
s6 track -i ./temp/run_net_01 --repeat -x

# Use the UI while iterating on overlays or pipeline behavior
s6 track -i ./temp/run_net_01 --repeat -v

# Keep the pipeline config pinned and replay at recorded timing
s6 track -i ./temp/run_net_01 --repeat --realtime-playback \
  --config ./configs/pipeline.config.yaml

Tips

  • Keep the same --config and --run-level when you want comparable runs.

  • Edit the relevant module under src/s6/app/pipeline/, then re-run the same replay command to validate changes.

  • s6 perf-stats summarizes metrics.json for one run or compares two runs.


3) Inspect or prune bad samples

Use the dataset filter UI to clean up the recorded data before training.

s6 data filter ./temp/run_net_01

If your training config already describes the dataset layout, you can point the filter at the config file instead:

s6 data filter --config ./cfg/ds_keypoint.json

Controls

  • a and d move to the previous or next entry in the current dataset.

  • w and s switch to the previous or next non-empty dataset when multiple dataset roots are configured.

  • x deletes the current entry.

  • q quits.


4) Summarize the run

If you recorded logs with -x, use the perf-stats tool to compare timing across runs or summarize the latest capture.

# Show stats for the latest run under ./logs
s6 perf-stats

# Compare two recorded runs
s6 perf-stats ./logs/runs/2024_10_01 ./logs/runs/2024_10_02

Troubleshooting

  • Recording is slow or drops frames: keep --record-only and close other heavy apps during collection.

  • Replay feels too fast or too slow: add --realtime-playback to honor the recorded timestamp spacing.

  • Results differ between runs: pin --config and --run-level, then verify the calibration file referenced by that config.


See also

  • Tracking app usage: application/track.md

  • Dataset browser: application/data-filter.md

  • Dataset management: application/dataset.md

  • Chrome trace workflow: recipes/pipeline_chrome_trace.md

  • Stats comparison tool: application/perf-stats.md