progress-monitoring-cv
Monitor construction progress using computer vision. Analyze site photos and drone imagery to track work completion, detect safety issues, and compare against BIM models.
What this skill does
# Progress Monitoring with Computer Vision
## Overview
This skill implements computer vision for construction progress monitoring. Analyze site images automatically to track completion, detect hazards, and compare physical progress against planned work.
**Applications:**
- Progress percentage estimation
- Safety compliance detection (PPE, barriers)
- As-built vs BIM comparison
- Material and equipment tracking
- Quality defect detection
## Quick Start
```python
import cv2
import numpy as np
from PIL import Image
import torch
from torchvision import models, transforms
# Load pre-trained model for construction scene analysis
model = models.resnet50(pretrained=True)
model.eval()
# Preprocess image
transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
# Load site photo
img = Image.open("site_photo.jpg")
input_tensor = transform(img).unsqueeze(0)
# Analyze
with torch.no_grad():
output = model(input_tensor)
print("Image analyzed successfully")
```
## Progress Detection System
### Core Progress Analyzer
```python
import cv2
import numpy as np
from PIL import Image
from typing import Dict, List, Tuple, Optional
from dataclasses import dataclass
from enum import Enum
import torch
from torchvision import models, transforms
from torchvision.models.detection import fasterrcnn_resnet50_fpn
class ConstructionPhase(Enum):
EXCAVATION = "excavation"
FOUNDATION = "foundation"
STRUCTURE = "structure"
ENCLOSURE = "enclosure"
MEP_ROUGH = "mep_rough"
FINISHES = "finishes"
COMPLETE = "complete"
@dataclass
class ProgressReport:
timestamp: str
image_path: str
detected_phase: ConstructionPhase
estimated_progress: float
detected_elements: List[Dict]
safety_observations: List[Dict]
quality_issues: List[Dict]
comparison_to_plan: Optional[float]
class ConstructionProgressAnalyzer:
"""Analyze construction progress from images"""
def __init__(self, use_gpu: bool = True):
self.device = torch.device('cuda' if use_gpu and torch.cuda.is_available() else 'cpu')
# Load detection model
self.detector = fasterrcnn_resnet50_fpn(pretrained=True)
self.detector.to(self.device)
self.detector.eval()
# Image transform
self.transform = transforms.Compose([
transforms.ToTensor()
])
# Construction element labels (would need fine-tuned model in production)
self.construction_labels = {
'column': ['column', 'pillar', 'post'],
'beam': ['beam', 'girder'],
'slab': ['floor', 'slab', 'deck'],
'wall': ['wall', 'partition'],
'scaffold': ['scaffold', 'scaffolding'],
'crane': ['crane', 'tower crane'],
'equipment': ['excavator', 'loader', 'truck'],
'worker': ['person', 'worker']
}
def analyze_image(self, image_path: str) -> ProgressReport:
"""Analyze a single construction site image"""
# Load image
img = Image.open(image_path).convert('RGB')
img_tensor = self.transform(img).to(self.device)
# Run detection
with torch.no_grad():
predictions = self.detector([img_tensor])
# Process detections
detected_elements = self._process_detections(predictions[0])
# Estimate phase and progress
phase = self._estimate_phase(detected_elements, img)
progress = self._estimate_progress(phase, detected_elements)
# Safety analysis
safety_obs = self._analyze_safety(img, detected_elements)
# Quality check (simplified)
quality_issues = self._check_quality(img)
return ProgressReport(
timestamp=self._get_timestamp(),
image_path=image_path,
detected_phase=phase,
estimated_progress=progress,
detected_elements=detected_elements,
safety_observations=safety_obs,
quality_issues=quality_issues,
comparison_to_plan=None
)
def _process_detections(self, predictions: Dict) -> List[Dict]:
"""Process model predictions into detected elements"""
elements = []
boxes = predictions['boxes'].cpu().numpy()
labels = predictions['labels'].cpu().numpy()
scores = predictions['scores'].cpu().numpy()
for box, label, score in zip(boxes, labels, scores):
if score > 0.5: # Confidence threshold
elements.append({
'box': box.tolist(),
'label': label,
'score': float(score),
'area': (box[2] - box[0]) * (box[3] - box[1])
})
return elements
def _estimate_phase(self, elements: List[Dict], img: Image) -> ConstructionPhase:
"""Estimate construction phase from detected elements"""
# Convert to numpy for color analysis
img_array = np.array(img)
# Color-based phase estimation (simplified)
hsv = cv2.cvtColor(img_array, cv2.COLOR_RGB2HSV)
# Brown/earth tones indicate excavation
earth_mask = cv2.inRange(hsv, (10, 50, 50), (30, 255, 255))
earth_ratio = np.sum(earth_mask > 0) / earth_mask.size
# Gray tones indicate concrete
gray_mask = cv2.inRange(hsv, (0, 0, 50), (180, 50, 200))
gray_ratio = np.sum(gray_mask > 0) / gray_mask.size
# Steel colors
steel_mask = cv2.inRange(hsv, (0, 0, 100), (180, 30, 255))
steel_ratio = np.sum(steel_mask > 0) / steel_mask.size
# Simple phase logic
if earth_ratio > 0.3:
return ConstructionPhase.EXCAVATION
elif gray_ratio > 0.2 and steel_ratio < 0.1:
return ConstructionPhase.FOUNDATION
elif steel_ratio > 0.1:
return ConstructionPhase.STRUCTURE
else:
return ConstructionPhase.ENCLOSURE
def _estimate_progress(self, phase: ConstructionPhase,
elements: List[Dict]) -> float:
"""Estimate progress percentage within phase"""
phase_base_progress = {
ConstructionPhase.EXCAVATION: 5,
ConstructionPhase.FOUNDATION: 15,
ConstructionPhase.STRUCTURE: 35,
ConstructionPhase.ENCLOSURE: 60,
ConstructionPhase.MEP_ROUGH: 75,
ConstructionPhase.FINISHES: 90,
ConstructionPhase.COMPLETE: 100
}
base = phase_base_progress.get(phase, 0)
# Adjust based on detected elements
element_count = len(elements)
adjustment = min(element_count * 0.5, 10)
return min(base + adjustment, 100)
def _analyze_safety(self, img: Image, elements: List[Dict]) -> List[Dict]:
"""Analyze safety compliance"""
observations = []
img_array = np.array(img)
# Check for safety vest colors (orange, yellow, green)
hsv = cv2.cvtColor(img_array, cv2.COLOR_RGB2HSV)
# Orange vest detection
orange_mask = cv2.inRange(hsv, (10, 100, 100), (25, 255, 255))
orange_pixels = np.sum(orange_mask > 0)
# Yellow vest detection
yellow_mask = cv2.inRange(hsv, (25, 100, 100), (35, 255, 255))
yellow_pixels = np.sum(yellow_mask > 0)
if orange_pixels + yellow_pixels < 100: # Threshold
observations.append({
'type': 'PPE_VISIBILITY',
'severity': 'Medium',
'message': 'Limited high-visibility clothing detected'
})
# Check for workers detected
worker_count = sum(1 for e in elements if e.get('label') == 1)
if worker_count > 0:
observations.append({
'type': 'WORKER_COUNT',
'severity': 'Info',
'message': f'{worker_count} woRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.