# Pattern: vegetation-management imagery

A regional electric utility operates an AI vegetation-management system that processes drone and helicopter imagery of power-line corridors. The model flags encroaching trees, structural damage, and clearance violations. Output drives field crews to inspect, trim, and remediate before a hazard turns into an outage or — in fire-prone regions — a wildfire ignition.

In summer, leafy canopy is easy to see against the lines. In winter — bare branches against bright sky, snow-occluded sightlines — model accuracy can drop by double digits. **Aggregate annual accuracy hides this**. Stratified evaluation surfaces it.

This pattern shows how to evaluate vegetation-management imagery models across seasonal and lighting conditions so blind spots are measured, not discovered.

## What's at stake

| Risk dimension                                          | Magnitude                                               | Framework                          |
| ------------------------------------------------------- | ------------------------------------------------------- | ---------------------------------- |
| Catastrophic-fire civil liability                       | $30B+ for the most-cited single utility liability event | Public CPUC and bankruptcy filings |
| NERC and state PUC enforcement on vegetation management | Per-finding civil penalty bands                         | Public NERC enforcement orders     |
| Per-hour outage cost from a downed line                 | $10K–$500K depending on customer mix                    | Industry reliability benchmarks    |
| Loss of life from wildfire ignition                     | Beyond financial accounting                             | Public wildfire-incident records   |

## The evaluation pattern

A **stratified evaluation** treats season, lighting condition, and equipment as first-class dimensions.

1. **Image-classification scorer** — per-class precision and recall on hazard categories (vegetation encroachment, equipment corrosion, clearance violation). Trace tags include `season`, `lighting_condition`, and `equipment_type`; results break out per-tag.
2. **Custom code grader (seasonal disparity)** — calculates hazard-detection-rate disparity between winter and summer trace sets; flags any disparity above a configured tolerance (e.g., 5%) as a regression.
3. **Compare models** — when a new model is proposed, it must close the seasonal disparity without losing summer performance. The comparison view shows side-by-side per-season scores.
4. **Continuous trace evaluation** — daily scoring on production drone-imagery samples. During high-risk seasons (fire season for fire-prone regions, winter ice for cold regions), cadence increases to hourly. Threshold alerts route to vegetation-management operations via Slack and email.

## Configuration in code

```python
# Python (SDK)
from layerlens import Stratix
client = Stratix()

seasonal_disparity = client.scorers.create_code(
 name="seasonal-disparity",
 code="""
winter_acc = mean(score for trace, score in zip(traces, scores) if trace.tags['season'] == 'winter')
summer_acc = mean(score for trace, score in zip(traces, scores) if trace.tags['season'] == 'summer')
result = {'passed': abs(winter_acc - summer_acc) <= 0.05, 'gap': summer_acc - winter_acc}
""",
)

trace_eval = client.trace_evaluations.create(
 trace_set={"tags": {"feature": "vegetation-management"}, "sample_rate": 0.01},
 scorers=[seasonal_disparity.id, hazard_classifier_scorer_id],
 schedule="daily",
)
```

```typescript
// TypeScript (REST)
const r = await fetch("https://stratix.layerlens.ai/api/v1/trace-evaluations", {
 method: "POST",
 headers: {
 "X-API-Key": process.env.LAYERLENS_STRATIX_API_KEY!,
 "Content-Type": "application/json",
 },
 body: JSON.stringify({
 trace_set: { tags: { feature: "vegetation-management" }, sample_rate: 0.01 },
 scorers: [seasonalDisparityId, hazardClassifierId],
 schedule: "daily",
 }),
});
```

## What you get

* Seasonal and lighting-condition disparities become measured dimensions on the dashboard, not undiscovered blind spots.
* Winter-specific training-data investment and evaluation-driven model improvements close the gap to within tolerance before the next high-risk season.
* Auditor-ready evaluation evidence for state PUC and NERC reviews — every release pin cites the evaluation IDs that gated it.
* Operations teams trust the model because the variance is explained, not absorbed into an opaque average.

## Stratix capabilities used

* [Custom code graders](https://github.com/LayerLens/gitbook-full/blob/main/08-evaluate/cookbook/custom-code-scorer.md) — seasonal-disparity computations
* [Compare models](/5.-select-pick-the-model/compare-models.md) — variant selection with seasonal-fairness criteria
* [Trace evaluations](/8.-evaluate-score-the-outputs/trace-evaluations.md) — daily continuous scoring during high-risk seasons
* [Notifications](https://github.com/LayerLens/gitbook-full/blob/main/13-reference/sdk-python/notifications.md) — Slack and email routing
* [Audit-friendly evidence guide](/11.-admin/audit-friendly-evidence.md)

## Replicate this

* [Industry → Energy and utilities](/4.2-industry-use-cases/energy-utilities.md)
* [Workflow: Govern](/9.-improve-tune-the-system/workflow.md)
* [Concept: Continuous evaluation](/7.-observe-see-whats-happening/continuous-evaluation.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.layerlens.ai/4.2-industry-use-cases/pattern-11.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
