Skip to main content

cgh-vision

Image understanding for cgh: a content inventory decides what each image contains, then only the extractors the content warrants run: architecture diagrams become markdown plus Mermaid, tables and charts become data, dense text becomes a summary. Everything runs against a local Ollama daemon; nothing leaves the machine.

pip install cgh-vision
ollama pull qwen2.5vl:3b gemma3:4b   # the benchmark-selected pair

cgh vision docs/architecture.png                 # markdown on stdout
cgh vision photo.jpg --profile photo             # screen-photo tuning
cgh vision archi.png --out report.md             # also save the report
cgh vision archi.png --format json | jq .diagram # the SDK dicts instead

The command shows a progress spinner on stderr while the model passes run (about 30 s per diagram on Apple Silicon); stdout stays pure markdown or JSON, pipeable either way.

Pipeline

  1. Inventory (non-directive: an image is never assumed to be a diagram; a logo or a photo costs one call and one summary line).
  2. Pre-scaling for small images: below 1000 px (smaller dimension), a 2x Lanczos upscale feeds the diagram passes, which the benchmark showed rescues thin-line exports (drawio) without ever hurting the others.
  3. Diagram extraction when warranted: structure with the plain contract, enrichment over the found labels (title, kinds, technologies, legend only if actually drawn), then a second model reads the arrows constrained to the found labels. Benchmarked ensemble: node precision 1.00, edge recall 0.80.
  4. Table / chart / text extractors as routed.
  5. Post-processing: fuzzy-duplicate merge, arrow annotations dropped from node lists, reversed-edge dedup, and identity separation: IPs, CIDRs, FQDNs, emails and server names split out of labels, recorded as pii.image_identity findings so the secure-at-rest layer pseudonymizes them.

Findings

Key Content
image.content detected types (architecture_diagram,table,...)
image.summary one-sentence description, FTS-searchable
diagram.mermaid the generated Mermaid
diagram.entities nodes/edges/zones as JSON
table.markdown / chart.markdown extracted data
text.summary dense-text summary
pii.image_identity identities read off the image (warn)

Configuration

[plugin.vision]
# profile = "default"        # default | fast (single call) | photo
# nodes_model = "qwen2.5vl:3b"
# edges_model = "gemma3:4b"  # set to "" to disable the edge pass
# ollama_url = "http://127.0.0.1:11434"
# timeout_s = 120
# prescale = true            # 2x upscale of small images (see Pipeline)
# prescale_min_px = 1000     # apply below this smaller-dimension size
# min_bytes = 5120           # skip icons and badges
# max_bytes = 20971520

Embedding

The pipeline is part of the cgh SDK surface (codegraph.sdk.image_*, MIT): image_inventory, extract_diagram, extract_table, extract_chart. See cgh's docs/EMBEDDING.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cgh_vision-0.2.0.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cgh_vision-0.2.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file cgh_vision-0.2.0.tar.gz.

File metadata

  • Download URL: cgh_vision-0.2.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cgh_vision-0.2.0.tar.gz
Algorithm Hash digest
SHA256 42f900b81106c8d621b87c99fa2b0ceb7f36f0851bd9c83cb96fad7b8b35e3a1
MD5 f4eea8b0924b942914d88f184f49e47b
BLAKE2b-256 b6d8ed61e3b311fa136bd7a587cd83f4d0467cf30a290c5801719ddd55d05d3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cgh_vision-0.2.0.tar.gz:

Publisher: release.yml on altikva/cgh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cgh_vision-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cgh_vision-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cgh_vision-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99f254c86a9dbe1ec7702729f3db94cb2a26eccac97d15ef7a4049b2a578e3b6
MD5 75f065dc9a57e8757b6db49cd9bf11ec
BLAKE2b-256 82e99a3d84c107f5ffeb31e1e87c712086317cca4a6b0fdf442b494d86e50482

See more details on using hashes here.

Provenance

The following attestation bundles were made for cgh_vision-0.2.0-py3-none-any.whl:

Publisher: release.yml on altikva/cgh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page