Targets and datasets#
Target catalogs#
sidescanpy.targets.Target describes one picked contact: id, position
(lat/lon and/or ping/channel/sample), optional measured bbox,
position_confidence (unknown < approximate < verified) and
category.
Function |
Purpose |
|---|---|
|
read an EdgeTech |
|
the format-agnostic catalog file |
|
cache per-ping positions of every |
|
the closest ping (geodesic distance) across files and frequencies |
|
the same for a whole catalog, grouped by file, frequency and channel |
|
Klein: place each target at the ping its catalog names (catalog ping time + number, no clock offset) |
|
estimate a constant clock offset between a catalog’s pick times and the survey (fallback for catalogs without ping fields) |
Native-resolution windows#
export.windows.native cuts windows that are square (chips) or a fixed
length (tiles) in metres from the native ping x sample grid and resizes
them with linear interpolation, for sonars whose ping spacing is much
coarser than their sample spacing:
Function |
Purpose |
|---|---|
|
one side, centred on a target |
|
the whole channel as dual-swath tiles (port mirrored left) |
|
map between image pixels and (ping, sample, channel), e.g. to turn annotation boxes back into sonar coordinates |
Building a dataset#
export.ml.build_target_dataset(sources, targets, spec, out_dir) renders
one image per target per style and writes COCO (targets.coco.json) and
YOLO (labels/, data.yaml) annotations. Everything that shapes the
dataset lives in one DatasetSpec, which round-trips to YAML.
|
Meaning |
|---|---|
|
|
|
|
|
output size, square |
|
meters per pixel for geometric/georef; a list renders each value as its own dataset |
|
|
|
size swath frames to the across-track extent the data fills (no black margins) |
|
|
|
augmentation: random offset of the target in the frame, draws per target, random horizontal/vertical flips |
|
placeholder box for targets with no measured extent (pixels, or meters converted per image) |
|
class names, and which targets get annotations |
|
background (no-target) images: windows whose footprint plus margin contains no catalog target |
|
train/val split (targets by id hash, backgrounds by file and ping block) and |
|
how values become 8- or 16-bit pixels |
Each run writes manifest.json and returns a DatasetResult with
per-style counts and the targets that were skipped and why.
Background images are only as clean as the catalog: an object missing from the catalog can appear in a background image and will be learned as background.
Lower-level pieces#
sidescanpy.export also exposes the building blocks: window extraction
(extract_chip, extract_full_channel, extract_geometric_window*,
extract_georef_window), orientation (orient_pixel_window,
orient_geo_window), augmentation (random_flip, jitter_offset_m),
quantization (to_uint8, to_uint16, from_uint8), and
export.ml.write_coco / write_yolo.
sidescan-export chip is a thin command-line wrapper over
build_target_dataset;
A training dataset with background images
runs it end to end on a public recording.