garmentiq v0.0.4.11

Automated garment measurement from images.

GarmentIQ turns a photograph of a garment into a set of tape-measure-style measurements. The pipeline runs in four stages: classification identifies the garment type, segmentation separates it from the background, landmark detection locates its key points, and the measurements are computed between those points using a per-garment instruction schema.

Each stage is a module that can be used on its own, or the whole sequence can be run by the tailor agent. Two optional modules refine the result: matting turns a hard mask into a soft alpha matte, and grounding turns a text phrase into boxes so SAM 1 and SAM 2 can be prompted with natural language.

Every model-backed module follows the same two-step shape::

model = giq.<module>.load_model(...)
result = giq.<module>.<run>(model=model, image_path=..., device="cpu")

Hardware acceleration is opt-in everywhere: device defaults to "cpu" and is never auto-detected. Pass "cuda" or "mps" to use an accelerator.

 1# garmentiq/__init__.py
 2"""Automated garment measurement from images.
 3
 4GarmentIQ turns a photograph of a garment into a set of tape-measure-style
 5measurements. The pipeline runs in four stages: **classification** identifies the
 6garment type, **segmentation** separates it from the background, **landmark**
 7detection locates its key points, and the measurements are computed between those
 8points using a per-garment instruction schema.
 9
10Each stage is a module that can be used on its own, or the whole sequence can be run
11by the `tailor` agent. Two optional modules refine the result: `matting` turns a hard
12mask into a soft alpha matte, and `grounding` turns a text phrase into boxes so SAM 1
13and SAM 2 can be prompted with natural language.
14
15Every model-backed module follows the same two-step shape::
16
17    model = giq.<module>.load_model(...)
18    result = giq.<module>.<run>(model=model, image_path=..., device="cpu")
19
20Hardware acceleration is opt-in everywhere: `device` defaults to `"cpu"` and is never
21auto-detected. Pass `"cuda"` or `"mps"` to use an accelerator.
22"""
23__version__ = "0.0.4.11"
24
25from .tailor import tailor
26from . import utils
27from . import classification
28from . import segmentation
29from . import landmark
30from . import matting
31
32
33def __getattr__(name):
34    """Expose optional subpackages without importing their heavy dependencies eagerly."""
35    if name == "grounding":
36        import importlib
37
38        # import_module avoids re-entering this __getattr__ (which `from . import
39        # grounding` would do, recursing infinitely); caching stops repeat lookups.
40        module = importlib.import_module(f"{__name__}.grounding")
41        globals()["grounding"] = module
42        return module
43    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")