contract
contract
#
The driver contract, as the library speaks it: stage images in, run, read outputs back.
- Stage.
stage_imagesre-encodes every image asimages/<staged_name>.jpgunder the workspace, its longest side at mostmax_dimension; the staged size is the size every output comes back at.staged_nameis the one naming rule: zero-padded, so a driver listing the directory in lexicographic order sees the array's order. - Run.
run_driverruns the model's driver in the GPU interpreter with--images,--weights(acgr.depth.snapshot) and--output, plus--multiviewwhen the images are posed together. - Read.
read_depthsturns each<staged_name>.npyand<staged_name>_conf.npyinto aRelativeDepth;read_camerasandread_pointsread the multi-view extras,cameras.jsonandpoints.npy/colors.npy.
Camera
dataclass
#
One posed image as a multi-view driver reports it: OpenCV, at the staged size.
Source code in capturegraph-recipes/capturegraph_recipes/depth/inference/contract.py
read_cameras(output)
#
The cameras a multi-view driver wrote, one per staged image in order.
Source code in capturegraph-recipes/capturegraph_recipes/depth/inference/contract.py
read_depths(output, count)
#
The driver's depth and confidence planes for count images as RelativeDepth values.
Source code in capturegraph-recipes/capturegraph_recipes/depth/inference/contract.py
read_points(output)
#
The points a multi-view driver wrote as (positions, colors).
Source code in capturegraph-recipes/capturegraph_recipes/depth/inference/contract.py
run_driver(work, driver, weights, *, multiview)
#
Run driver over the staged images with weights; the output directory.
Source code in capturegraph-recipes/capturegraph_recipes/depth/inference/contract.py
stage_images(images, work, max_dimension)
#
Re-encode images as images/<staged_name>.jpg under work.
A side longer than max_dimension is shrunk to it, aspect kept.
Returns:
| Type | Description |
|---|---|
list[tuple[int, int]]
|
Each image's stored |
list[tuple[int, int]]
|
the staged size is re-expressed at. |
Source code in capturegraph-recipes/capturegraph_recipes/depth/inference/contract.py
staged_name(index)
#
The file stem of the image at index in a staged directory; sorts like the array.