A vug is a hole in the rock, and on an unwrapped borehole image it shows up as a dark, low-resistivity blob against a brighter carbonate background. The trouble is that plenty of things that are not vugs also show up as dark blobs: the conductive trace of a fracture, a wellbore-parallel tool artefact, a smear of mud in a washout. For a mid-sized Middle East carbonate operator we partnered with, the bottleneck in automated vug quantification was never detecting dark regions — a thresholding step finds those by the hundred. The bottleneck was deciding which dark regions are real dissolution porosity and which are spurious. This case study is about how our team closed that gap, and the punchline is that we did it with an engineered geometric gate, not a heavier model.
Why a bigger network was the wrong instinct
The reflex, when a detector over-fires, is to reach for more capacity — a deeper segmentation backbone, more labelled masks, a learned classifier on top of the contours. We resisted it for two reasons specific to this engagement.
First, the data regime would not support it. The vug-quantification dataset here was two vertical wells of dolomitised carbonate, processed in one-metre patches — nowhere near enough labelled examples to train a discriminative false-positive classifier that would generalise rather than memorise. Second, the resolution floor is unforgiving: one pixel in the source binary wireline log fileThe binary wireline log file the raw image arrays are read from — the digital log format the two microresistivity imaging tools write to. corresponds to about 3 cm of borehole, so every contour carries an inherent ±3 cm position error before any algorithm touches it. Throwing model capacity at a problem whose ground truth is fuzzy at the pixel level buys you overfitting, not discrimination.
So we inverted the question. Instead of asking a network to learn what a vug looks like, we asked what physically distinguishes a real dissolution pore from an artefact, and encoded that as an explicit, auditable filter — a piece of deterministic computer-vision engineering, not a black box. That choice is what makes the output a defensible vug catalogue an interpreter will sign rather than a contour dump they have to re-check by hand.
The pipeline up to the gate
The vug workflow is a classical computer-vision morphology pipeline, deliberately so. Each one-metre patch of the dynamic image log passes through:
- Top-K mode extraction and subtraction. We take the K = 5 most frequent pixel-intensity modes (intensities run 0–255 on the dynamic image) and subtract them. The dominant modes are the lithological background; removing them lifts the low-resistivity anomalies — the candidate vugs — out of the rock matrix.
- Adaptive thresholding. A local, block-wise Gaussian threshold binarises the mode-subtracted image. The block size sets the spatial scale at which "dark" is judged locally rather than globally — critical on logs whose contrast drifts down-hole.
- Contour identification. Connected-component contour tracing turns each surviving dark region into a closed contour with a measurable area, centroid, and shape.
At this point you have candidates — and you have your false positives. Everything dark is now a contour, including the fracture traces and the wellbore-parallel streaks that are emphatically not pores. The gate is what comes next.
The block-size dial is a physical choice, not a hyperparameter
We swept the adaptive-threshold block size across n = 11, 21, 31, 41, 51 pixels and settled on 31. That is not arbitrary tuning — at this log resolution an 11-pixel block covers roughly 5.87 cm² of borehole and a 51-pixel block 126.08 cm², so 31 pixels (about 46.58 cm²) is the window that matches the size of the dissolution features we are trying to resolve. Pick the block to fit the geology, then the threshold means something.
The gate: circularity, then area, then contrast
The core discrimination is a single geometric observation about carbonate dissolution. Real vugs are roundish. They are pores eaten into the rock; they are not long, thin, planar traces. A fracture crossing the image is elongated; a tool artefact is wellbore-parallel and skinny. Circularity — the ratio of a contour's area to that of a circle with the same perimeter — separates these populations almost on its own.
In this field the measured circularity of detected blobs spanned 0.28 to 0.85, and the real vugs clustered at a peak of 0.45–0.7 — semi-circular dominant, exactly the signature of dissolution porosity. So we apply a circularity gate of 0.3–1.0: contours below 0.3 are rejected as linear features (fractures, parallel artefacts), and everything from semi-circular to near-circular is kept as a vug candidate. That one threshold removes the largest class of false positives — the elongated ones — at essentially no compute cost.
Area is the second filter, and it is gentler but still discriminating. Vug area in this reservoir ran 1–12 cm², concentrated in the 1–3.5 cm² band (1–6 cm² zone-wise) — a right-skewed distribution. Contours far outside that envelope are suspect: a multi-tens-of-cm² "blob" on a carbonate face is far more likely a washout or a merged artefact than a single pore. The area window therefore trims the tails the circularity gate lets through.
The final layer is the one that does the subtle work — the contrastive and vicinity filtering, hardened with a Laplacian and a mean-based check, that decides whether a surviving contour is genuinely darker than its surroundings or just a local fluctuation. Two mechanisms run together. A Laplacian-based test expands each candidate's bounding box by 20% (10% per side) and asks whether the contour is a real second-derivative edge against that expanded neighbourhood. A mean-based test enlarges the candidate to a circle of radius 2R and compares interior intensity to that vicinity, with the local threshold constant C set to the patch mean. Candidates that fail to stand out against their own neighbourhood — the low-contrast ghosts that survive thresholding but are not pores — are dropped here.
Tuning the gate without overfitting it
Every constant in that chain was chosen by a sweep, not a guess, and the chosen values were then frozen as defaults across wells — parameters managed as version-controlled configuration rather than re-trained weights:
- Centroid-difference τ — the spacing that prevents the same vug being counted twice across overlapping detections — was tested at 0, 1, 3, 5, 8, 12 and fixed at τ = 5.
- The Laplacian threshold was swept 0.05–0.75 and set to 0.25.
- The local threshold constant C was tested at −2, −1, mean, +1, +2; the patch mean (or −1) won.
- The standing default set — k = 5 modes, inter-mode spacing δ = 5, circularity ratio 0.3–1.0, IoU overlap threshold 0.2, Laplacian box expansion 10% (20% total), mean-based radius 2R, block size 31 — is the configuration that the sweeps converged on.
The honest part of the story is that the gate is not perfectly universal. The geometric thresholds (circularity, area, τ) held across wells, but the contrast-sensitivity constants needed per-well retuning because image-log contrast itself varies well to well: one validation well ran a Laplacian of 0.7 and a mean-based factor of 1.0 with C = −1.0, another needed a Laplacian of 0.15, mean-based 0.4, and a wider block size of 51. That is a feature of an explicit pipeline, not a bug — when contrast drifts, an engineer turns two interpretable dials, instead of re-labelling masks and retraining a black box.
What the gate bought the operator
Validated against expert picks, the gated workflow produced a vug-percentage curve — vug area over interval area, computed every 10 cm — whose vug-area estimate agreed with the human interpreter to a mean absolute error of 1.21 cm². That is the load-bearing number: it says the automated catalogue agrees with the expert to within roughly one small pore's worth of area per zone, which is well inside the ±3 cm positional noise the binary wireline log file's resolution imposes in the first place.
Before
Every dark blob
Adaptive-threshold contours: fractures, wellbore-parallel artefacts, and low-contrast ghosts all counted as porosity
After
Defensible catalogue
Circularity gate (0.3–1.0) + area window (1–12 cm²) + Laplacian/mean contrast filter; per-10 cm vug-area within 1.21 cm² MAE of expert
False positives removed without a heavier model
Two outcomes matter beyond the headline metric. First, in a side-by-side against the operator's existing interpretation-software ground truth, the gated pipeline caught additional real vugs the manual pass had missed at several discrete depth intervals — the gate is not merely conservative, it recovers true positives a human eye skipped. Second, its remaining errors are interpretable: the one notable failure mode was a minor misidentification of an induced fracture as porosity, exactly the kind of edge case the contrast filter is designed to be tuned against, and exactly the kind a black-box classifier would surface with no explanation.
Downstream of the gate, the surviving catalogue feeds a per-10 cm statistical summary — total count, total area, mean area, standard deviation of area, an area/porosity spectrum, a circularity spectrum, and an azimuth spectrum — which is the form a petrophysicist actually consumes. None of that is trustworthy if the contours feeding it are half artefact. The gate is what makes the statistics mean something.
Why this generalises
The architectural lesson travels beyond one Middle East field, and beyond vugs. When the discriminating signal is a physical shape — roundness, size, local contrast — an explicit geometric gate will often out-behave a learned classifier trained on scarce labels, and it will do so transparently. Across our subsurface engagements with operators in the Middle East and the United States, the pattern repeats: the wins that survive contact with a validator are the ones where every rejection has a reason an interpreter can read. A circularity threshold is auditable; a softmax over a contour embedding is not. For a deliverable that an operator's petrophysics team has to defend in a reserves discussion, auditability is not a nice-to-have — it is the product.
How a geometric gate beat a bigger model on vug detection
- False positives were the bottleneck, not detection: adaptive thresholding finds every dark blob, but fractures and tool artefacts look like vugs. The fix was an engineered contour gate, not added model capacity — the two-well, ±3 cm-resolution regime would have overfit any learned FP classifier.
- Circularity does the heavy lifting: real dissolution vugs are semi-circular (measured circularity peaked at 0.45–0.7 within a 0.28–0.85 span), so a 0.3–1.0 circularity gate rejects elongated fractures and wellbore-parallel artefacts almost for free, with an area window (1–12 cm²) and a Laplacian/mean contrast check removing the tails and low-contrast ghosts.
- Explicit and auditable beats black-box: every constant was sweep-chosen and frozen (τ=5, Laplacian 0.25, block size 31, C=mean), the per-10 cm vug-area landed within 1.21 cm² MAE of the expert, and the pipeline even recovered vugs a manual interpretation-software pass missed — with failures an engineer can diagnose by turning two interpretable dials.
References
-
Vug-quantification workflow, parameter sweeps (circularity 0.3–1.0; block size 11/21/31/41/51; τ ∈
{0, 1, 3, 5, 8, 12}; Laplacian 0.05–0.75; C ∈{−2, −1, mean, +1, +2}), and the 1.21 cm² mean-absolute-error validation derived from internal work on a two-well Middle East carbonate dataset logged with two different microresistivity imaging tools; data and code withheld under operator confidentiality. -
Circularity, area, and per-10 cm statistical-spectrum definitions per the internal vug-detection manuscript and supplementary materials; figures and intervals anonymised.