Building practical AI
Deepak Kumar Tiwari

Deepak Kumar Tiwari

Technology & AI Leader · Building practical systems

Multimodal inspection / Guide 82

Pipeline Visual Inspection Must Preserve Unseen Segments

Design a pipeline visual inspection harness that validates chainage, timestamps, measurement uncertainty, and unseen segments before preparing human review packets.

Illustrative engineering guide. Examples are not client deployments, production-ready integrations, or evidence of measured results. Validate the design with your domain and security owners.

Reference workflow: Segment capture manifest; Candidate observations; Chainage registration; Coverage and uncertainty gate; Human inspection packet.
Reference workflow. Steps identify responsibilities, not necessarily separate agents. Branches and recovery paths are explained below. Open full-size diagram.

A hypothetical crawler records a hundred-meter exposed pipeline section. Its video shows a discolored patch near a weld, then freezes while the distance encoder continues advancing. A summarizer labels the route “inspected” because the last telemetry record reaches the destination. The failure is not merely an incorrect description of discoloration. It is the conversion of traveled distance into visual coverage.

The engineering objective is an advisory inspection packet that distinguishes captured, usable, obstructed, and missing intervals. Neither a clean-looking surface nor complete route telemetry establishes wall thickness, leak absence, hidden damage, or fitness for operation. This workflow provides no automated pipeline safety clearance and does not replace the operator’s inspection procedures or specialist examination.

Two Position Streams Are Not One

Bind each recording to a pipeline asset, segment boundaries, asset revision, capture session, and original media digest. Store the source frame identifier and presentation timestamp, plus the corresponding encoder sample and clock alignment version. A frame number alone cannot locate an observation if frames were dropped or the file was transcoded.

Define chainage in meters increasing from a named upstream datum. Define clock position in degrees around the pipe with an explicitly documented viewing direction. Local image coordinates still use pixels from the upper-left corner. Reversing crawler direction must not silently reverse chainage or swap the meaning of the twelve-o’clock surface position.

The W3C provenance model overview supports representing source entities and the activities that derive new records. Use it as a design vocabulary for linking a cropped weld image back to the recording, encoder alignment, and person confirming the segment identity. A derived thumbnail should never replace the original recording as the sole evidence artifact.

Find the Coverage Hole Before Describing It

The candidate interpretation should be narrow: “surface color variation near registered chainage.” A specialist measurement stage determines whether a scale target, laser profile, or other authorized instrument supports an actual dimension. Uncalibrated RGB frames cannot supply corrosion depth. They also cannot determine temperature or identify the cause of an apparent mark.

OpenCV’s calibration documentation explains why lens distortion and camera pose belong in the measurement process. A scale calibrated at one standoff distance cannot simply be carried through changing pipe curvature and camera distance. Keep physical measurements unavailable until the appropriate measurement method validates those assumptions.

Represent coverage as the union of usable chainage intervals, not the sum of interval lengths. Overlapping passes otherwise inflate the inspected distance. Coverage must also retain circumferential sectors: viewing the crown twice does not inspect the underside. A conservative first release can require complete sectors within short segments and send everything else to a recapture queue.

Run a Synthetic Interval Harness

The following self-contained Python fixture tests the HARNESS, not a trained vision model, a camera, or real inspection performance. It models a single required surface sector and supplied chainage measurements. Its age and registration limits are illustrative policy values, not pipeline standards. It performs no real media or engine API calls.

from math import isfinite

base = dict(asset="PIPE-9", revision=3, sector="crown",
            frame="upstream-chainage-m", captured_s=100,
            media="synthetic-crawler-A", registration_m=0.1,
            intervals=[(0.0, 40.0), (30.0, 60.0), (80.0, 100.0)])

def coverage(m, now_s=120):
    if (m["asset"], m["revision"], m["sector"], m["frame"]) != (
            "PIPE-9", 3, "crown", "upstream-chainage-m"):
        return "abstain:identity"
    if not m["media"] or not 0 <= now_s - m["captured_s"] <= 60:
        return "abstain:time"
    u = m["registration_m"]
    if not isfinite(u) or not 0 <= u <= 0.25:
        return "abstain:registration"
    merged = []
    for start, end in sorted(m["intervals"]):
        if not all(isfinite(x) for x in (start, end)) or not 0 <= start < end <= 100:
            return "abstain:interval"
        if merged and start <= merged[-1][1]:
            merged[-1][1] = max(merged[-1][1], end)
        else:
            merged.append([start, end])
    fraction = sum(b - a for a, b in merged) / 100
    return ("review" if fraction == 1 else "recapture", fraction)

assert coverage(base) == ("recapture", 0.8)
assert coverage(dict(base, intervals=[(0, 100), (0, 100)])) == ("review", 1.0)
assert coverage(dict(base, intervals=[])) == ("recapture", 0.0)
assert coverage(dict(base, registration_m=2)) == "abstain:registration"
assert coverage(dict(base, revision=2)) == "abstain:identity"
print("pipeline coverage harness: five assertions passed")

The naive interval sum is ninety meters, but the union covers only eighty. The fixture therefore exposes an observable bookkeeping error without claiming to detect a frozen video. A production media-quality stage must independently identify repeated or unusable frames and withhold their intervals. Accepted nominal coverage remains subject to position uncertainty; it is not proof that every physical point was visible.

Handle Measurement and Operational Uncertainty

Record encoder uncertainty, clock-offset uncertainty, and image-to-chainage registration residuals independently. NIST’s combined uncertainty guidance explicitly accounts for covariance. Encoder drift shared across neighboring observations cannot be averaged away by collecting more frames. Conservative endpoint buffers may be appropriate for coverage accounting, but their size must come from the capture method and reviewed policy.

Use a deterministic validator rather than a committee of agents to check interval bounds and revisions. A specialist service is justified when it supplies genuinely different measurements, such as an authorized thickness result. Keep that result’s instrument, method, time, and location provenance separate from the visual candidate. A language model can organize the packet but cannot upgrade either source’s authority.

Protect recordings with server-side segment access checks and tenant-scoped storage. Treat labels and OCR text as untrusted content. The snippet omits authentication, field-device trust, durable state, database transactions, approvals, and work-order provider semantics. Those omissions matter: a syntactically valid asset identifier is not evidence that the uploader may access it.

An approved follow-up ticket should reference the missing interval and sector, not demand a repair based on color alone. Deduplicate writes using segment, session, interval, and policy revision. A timeout leaves creation status unknown until reconciled. Field-service dispatch explains the operational handoff; mining survey change detection develops the related distinction between surveyed extent and valid evidence.

Acceptance Tests and Evaluation

  • Duplicate the same pass; unique coverage must remain unchanged rather than exceed one hundred percent.
  • Freeze imagery while chainage advances; the media-quality integration must leave that interval unknown.
  • Reverse crawler direction; require an explicit coordinate transform and verified segment endpoints.
  • Supply an old segment revision or future capture time; prevent its inclusion in the current packet.
  • Hide the underside while showing the crown; never claim whole-pipe surface coverage.
  • Lose a work-order response after approval; reconcile the authoritative record before another creation attempt.

Evaluate against manually annotated sessions with known route gaps. Measure falsely accepted complete sessions divided by all incomplete sessions, plus correctly retained usable intervals divided by all adjudicated usable intervals. Report by pipe appearance, motion condition, and access geometry. Frames within a pass are correlated; split evaluation by independent sessions and assets rather than random frames.

Begin with offline replay and review-only exports for one segment type. Track reviewer disagreement, recapture burden, and unresolved localization errors alongside processing time. AI systems engineering should first deliver the interval manifest and explicit unknown state. Faster narrative generation has little value if the packet hides twenty meters that nobody actually saw.

Sources