SEMANTIC LIBRARY — SEGMENTATION MASK ONTOLOGY
FLOW ALGEBRA COMPANION FORMALISATION | VERSION 1.0 | 03 NOVEMBER 2026
SOURCE: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/computer-vision-entities/segmentation-mask-ontology.html
SOURCE AUTHORS: Mark Anthony Higgins — Sky Recursive AI
SOURCE COPYRIGHT: © Mark Anthony Higgins, 11 October 2025; revised 01 August 2026.
FORMALISATION CREDIT: Mark Anthony Higgins — Sky Recursive AI
STATUS: Companion formalisation constructed from the ontology title and standard computer-vision semantics. The complete embedded source specification was not available in the accessible page text. These are proposed formal rules, not a verbatim extraction.
1. PURPOSE
Represent segmentation masks as spatially indexed assignments of image elements to foreground/background, semantic classes, or object instances. Define validation, inference, transformation, provenance, uncertainty and recursive state updates.
2. ENTITY MODEL
S = (I, R, B, K)
I: image and mask input state (image grid, predicted labels, logits, annotations).
R: relationships (pixel-in-region, mask-of-object, class-of-region, overlaps, derived-from).
B: boundaries (image extent, label vocabulary, valid coordinates, confidence threshold, provenance).
K: knowledge (class ontology, model version, calibration, annotations, spatial conventions).
Image domain: Ω = {(x,y) | 0 ≤ x < W, 0 ≤ y < H}, with W,H positive integers.
Binary mask: M_b: Ω → {0,1}.
Semantic mask: M_s: Ω → C ∪ {void}, where C is a finite class set.
Instance mask: M_i: Ω → J ∪ {background,void}, where J is a set of instance identifiers.
Soft mask: P: Ω × C → [0,1], with Σ_c P(x,y,c)=1 for valid classified pixels.
Mask entity: m=(id, image_id, kind, grid, label_map, confidence, provenance, transform, version).
3. FLOW ALGEBRA
E_t = expand(I_t,R_t)
V_t = {m ∈ E_t | valid(m,B_t,K_t)}
m*_t = argmax_{m ∈ V_t} Score(m | I_t,R_t,B_t,K_t)
I_{t+1} = update(I_t,m*_t,observations_t)
If V_t is empty, return an explicit abstention/error state; argmax is undefined.
Pixel decision: M_s(x,y)=argmax_{c ∈ C} P(x,y,c), provided max_c P(x,y,c) ≥ τ; otherwise void.
Binary decision: M_b(x,y)=1[P(x,y,foreground) ≥ τ].
Connected components: CC(M_b) = maximal connected foreground subsets under a declared 4- or 8-neighbour convention.
Region area: A(m)=Σ_{(x,y)∈Ω} 1[M_b(x,y)=1].
Intersection over union: IoU(A,B)=|A∩B|/|A∪B| when |A∪B|>0; otherwise undefined unless a convention is explicitly declared.
Dice(A,B)=2|A∩B|/(|A|+|B|) when the denominator is positive.
4. IMPLEMENTS / PROCESS
INPUT → CHECK DIMENSIONS → ALIGN COORDINATES → NORMALISE SCORES → ASSIGN LABELS → BUILD MASK → VALIDATE → LINK ENTITIES → EMIT RESULT.
Inputs: image, class schema, model output or annotation, threshold and provenance.
Outputs: typed mask, regions, object links, confidence metadata, validity status and trace.
Failure: incompatible grids, unknown labels, non-finite scores, invalid transforms or missing provenance where required.
5. HOW TO READ
A mask is a typed spatial relation, not merely an image overlay. A foreground value asserts membership in a region. A semantic value asserts a class label. An instance value asserts membership in one distinguished object instance. Confidence is separate from the hard label. Boundary B defines which assertions may be accepted.
6. TRI-MAPPING
Physical/observational: sensor image, annotation, visible surface or measured object.
Mathematical: finite grid Ω, indicator function, partition, probability field and geometric transformation.
Semantic/AI: image entity → segmentation mask → region → object/class → evidence and confidence.
Mapping is conditional on coordinate alignment and declared label semantics; it does not prove physical object identity.
7. RELATIONSHIP GRAPH
DigitalImage --hasPixelDomain--> Ω
SegmentationMask --derivedFrom--> DigitalImage
SegmentationMask --hasMaskType--> {binary,semantic,instance,soft}
SegmentationMask --assignsLabelTo--> Pixel
SegmentedRegion --subsetOf--> ImageRegion
SegmentedRegion --classifiedAs--> SemanticClass
InstanceMask --refersTo--> VisualObjectCandidate
SegmentationMask --generatedBy--> ModelOrAnnotator
SegmentationMask --supportedBy--> PerceptionEvidence
SegmentationMask --hasConfidence--> PerceptionConfidence
SegmentationMask --mayOverlap--> SegmentationMask
8. INFERENCE RULES
R1: validGrid(m) ∧ validLabels(m) ∧ validProvenance(m) → eligible(m).
R2: M_b(p)=1 → belongsTo(p,foregroundRegion(m)).
R3: M_s(p)=c ∧ c∈C → hasSemanticLabel(p,c).
R4: M_i(p)=j ∧ j∈J → candidateMemberOf(p,instance(j)).
R5: validAlignment(m,image) ∧ eligible(m) → spatiallyComparable(m,image).
R6: overlap(m1,m2)>0 → spatialOverlap(m1,m2); NOT necessarily sameObject(m1,m2).
R7: confidence(p)<τ → abstainOrVoid(p) under the declared policy.
R8: invalidCoordinateTransform(m) → rejectSpatialClaims(m).
R9: maskVersionChanged(m) → revalidateDependentRegions(m).
9. VALIDATION
V1: W,H are positive; mask grid dimensions agree with the image or have an explicit invertible/reproducible mapping.
V2: labels belong to the declared vocabulary; instance IDs are consistent within the specified frame.
V3: probabilities are finite and in [0,1]; normalisation tolerance is documented.
V4: void, background and occluded/unknown have distinct declared meanings.
V5: pixel connectivity, boundary convention and interpolation method are recorded.
V6: resampling of categorical masks uses an appropriate label-preserving policy (commonly nearest-neighbour); soft masks may use interpolation followed by re-normalisation.
V7: region/object identity claims require separate evidence beyond mask geometry.
V8: privacy, safety and domain-specific restrictions are applied before downstream action.
10. EXECUTION DIAGRAM
[Image / Prediction / Annotation]
|
[Grid & Schema]
|
[Coordinate Align]
|
[Score / Label Map]
|
[Mask Entity]
|
{Valid under B?}
/ \
No Yes
| |
[Error / Abstain] [Regions & Relations]
|
[Evidence + Trace]
|
[Publish Result]
11. MAPPING TABLE
INPUT IMAGE → Image entity → Ω, W, H, reference frame
MODEL LOGITS → Soft mask → P(x,y,c)
CLASS LABELS → Semantic mask → M_s(x,y)
INSTANCE IDS → Instance mask → M_i(x,y)
BINARY SELECTION → Foreground region → M_b(x,y)
REGION GEOMETRY → Spatial relations → area, intersection, union
EVIDENCE → Provenance relation → source/model/annotation/version
12. CONDITIONAL EXECUTION GUARANTEE
Given a finite image grid, well-typed inputs, deterministic tie-breaking, valid transforms, and terminating validation functions, mask construction and rule evaluation terminate. This guarantees an auditable computation or explicit failure state, NOT correctness of perception, calibration, object identity or downstream decisions.
13. AI SEARCH FLOW
FLOW_ID: semantic-library.computer-vision.segmentation-mask.v1
AUTHORS: Mark Anthony Higgins; Sky Recursive AI
SOURCE: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/computer-vision-entities/segmentation-mask-ontology.html
CITATION_BACKLINK: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/computer-vision-entities/segmentation-mask-ontology.html
PURPOSE: Retrieve and reason over segmentation-mask entities with validated spatial and semantic relations.
STATE_MODEL: S=(I,R,B,K)
ENTITIES: DigitalImage, Pixel, SegmentationMask, ImageRegion, VisualObjectCandidate, SemanticClass, PerceptionEvidence, PerceptionConfidence.
PATHWAYS: acquire > align > infer/annotate > construct > validate > relate > publish.
MINI_RECURSION_ENGINE: I_(t+1)=update(I_t,validated_mask_t,new_evidence_t); recheck affected dependencies on revision.
INFERENCE_RULES: R1–R9 above.
CONFIDENCE: retain per-pixel/per-region scores and calibration metadata; never treat raw scores as guaranteed probabilities.
SEMANTIC_EQUIVALENCE: two masks are equivalent only relative to declared domain, type, label mapping and comparison criterion.
FLOW_HASH: to be computed from canonical published file bytes at deployment; not pre-populated.
UPDATE_MODEL: versioned, provenance-preserving, with explicit invalidation of dependent results.
14. LICENCE AND CITATION
Follow the applicable Open Research Licence published by Kireth Research. Retain author attribution and source backlink. No licence terms are inferred from inaccessible embedded material.
END OF FLOW ALGEBRA
Download Code
Copy to Clipboard