YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

YOLOv7 Window Detection with Measurements

A YOLOv7 model fine-tuned for detecting windows with dimensional measurements in architectural drawings.

Model Description

This model is a fine-tuned YOLOv7 object detector specialized for the window manufacturing industry. It automatically detects and locates windows with dimensional measurements in order documents, proposals, and technical drawings.

The model enables window manufacturers to:

  • Automate order processing by detecting window boundaries in scanned or digital documents
  • Extract individual window specifications from multi-window orders
  • Support digital workflows for production planning and quoting
  • Improve quality control by validating order completeness

Model Type: Object Detection (YOLOv7)
Industry: Window Manufacturing & Installation
Task: Window boundary detection in order documents and technical drawings
Classes: 1 (window)

Training Data

The model was trained on a custom dataset of architectural drawings containing:

  • Training Images: 243 annotated images
  • Validation Images: 61 annotated images
  • Total Annotations: ~166 window instances
  • Image Types: Scanned architectural drawings, floor plans, and technical construction documents

All images were manually annotated using labelImg with bounding boxes around windows. The dataset includes various drawing styles, scales, and quality levels to ensure robust detection.

Training Method

Base Model: YOLOv7 (pre-trained weights: yolov7_training.pt)
Training Approach: Transfer learning / Fine-tuning
Configuration:

  • Epochs: 300
  • Batch Size: 8
  • Image Size: 640×640
  • Device: CPU
  • Optimizer: SGD with momentum
  • Learning Rate: 0.01 (with cosine annealing)

Final Performance Metrics:

Intended Use

Primary Use Case

This model was specifically created for window manufacturers and their business partners to automate the processing of window orders and proposals. The model detects window boundaries with visible measurements in technical drawings and order documents, enabling:

  • Automatic window boundary recognition in order documents and proposals
  • Automated cropping and extraction of individual window specifications from multi-window drawings
  • Perimeter and dimension calculations for manufacturing and quoting processes
  • Quality control by verifying presence and completeness of window specifications
  • Digital workflow automation for converting paper/PDF orders into structured data

Intended Users

  • Window manufacturers (production planning, order processing)
  • Window installation companies and contractors
  • Manufacturing partners in the window supply chain
  • Sales and quotation teams processing customer orders
  • Quality assurance teams validating order specifications

Limitations

  • Domain-specific: Optimized for architectural drawings; may not perform well on photographs or other image types
  • Drawing quality: Performance may degrade on heavily degraded or low-quality scans
  • Measurement accuracy: While the model detects windows with measurements, it does not extract or verify the numerical values
  • Drawing styles: Best performance on technical/engineering drawings; artistic renderings may yield lower accuracy
  • Language: Trained primarily on drawings with labels/text in specific language(s); may need adaptation for other languages

How to Use

Installation

pip install torch torchvision
git clone https://github.com/WongKinYiu/yolov7.git
cd yolov7

Inference Code

import torch
from models.experimental import attempt_load
from utils.general import non_max_suppression, scale_coords
from utils.datasets import letterbox
import cv2
import numpy as np

# Load model
device = torch.device('cpu')  # or 'cuda:0' for GPU
model = attempt_load('window_with_measurements_best.pt', map_location=device)
model.eval()

# Prepare image
img_path = 'your_drawing.jpg'
img0 = cv2.imread(img_path)
img = letterbox(img0, 640, stride=32)[0]
img = img[:, :, ::-1].transpose(2, 0, 1)  # BGR to RGB, to 3x640x640
img = np.ascontiguousarray(img)
img = torch.from_numpy(img).to(device)
img = img.float() / 255.0
if img.ndimension() == 3:
    img = img.unsqueeze(0)

# Inference
with torch.no_grad():
    pred = model(img)[0]
    pred = non_max_suppression(pred, 0.25, 0.45)

# Process detections
for det in pred:
    if len(det):
        det[:, :4] = scale_coords(img.shape[2:], det[:, :4], img0.shape).round()
        for *xyxy, conf, cls in det:
            label = f'window {conf:.2f}'
            print(f"Detected: {label} at {xyxy}")
            # Draw bounding box
            cv2.rectangle(img0, (int(xyxy[0]), int(xyxy[1])), 
                         (int(xyxy[2]), int(xyxy[3])), (0, 255, 0), 2)
            cv2.putText(img0, label, (int(xyxy[0]), int(xyxy[1])-10),
                       cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)

# Save result
cv2.imwrite('result.jpg', img0)

Batch Processing for Window Orders

import glob
from pathlib import Path

# Process multiple order documents
order_paths = glob.glob('orders/*.jpg')
for order_path in order_paths:
    # Run inference (use code above)
    # Save results to output directory
    pass

Practical Example: Extract Windows for Manufacturing

import os

def extract_windows_from_order(image_path, output_dir):
    """
    Extract individual windows from an order document for processing.
    Useful for separating windows for perimeter calculation, quoting, etc.
    """
    # Load and run inference (use inference code above)
    img0 = cv2.imread(image_path)
    # ... run detection ...
    
    # Extract each detected window
    for idx, (*xyxy, conf, cls) in enumerate(det):
        # Crop window region
        x1, y1, x2, y2 = map(int, xyxy)
        window_crop = img0[y1:y2, x1:x2]
        
        # Save individual window
        window_filename = f"{Path(image_path).stem}_window_{idx+1}.jpg"
        cv2.imwrite(os.path.join(output_dir, window_filename), window_crop)
        
        # Optional: Calculate bounding box dimensions for perimeter
        width_px = x2 - x1
        height_px = y2 - y1
        print(f"Window {idx+1}: {width_px}x{height_px} pixels")

# Usage
extract_windows_from_order('order_12345.jpg', 'extracted_windows/')

Training Details

Hardware: CPU (Mac)
Training Time: ~23.4 hours for 300 epochs
Framework: PyTorch 2.8.0
YOLOv7 Repository: WongKinYiu/yolov7

License

This model is released under the GPL-3.0 License (inherited from YOLOv7).

For commercial use, please review the YOLOv7 license terms and ensure compliance.

Citation

If you use this model in your research or project, please cite:

@misc{yolov7-window-detection,
  title={YOLOv7 Window Detection with Measurements},
  author={Your Name},
  year={2025},
  howpublished={\url{https://huggingface.co/your-username/yolov7-window-detection}}
}

And the original YOLOv7 paper:

@article{wang2022yolov7,
  title={{YOLOv7}: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors},
  author={Wang, Chien-Yao and Bochkovskiy, Alexey and Liao, Hong-Yuan Mark},
  journal={arXiv preprint arXiv:2207.02696},
  year={2022}
}

Contact

Developed by: Modernaus Ugdymo Centras (MUC)
Website: https://muc.lt

For questions, collaboration opportunities, or to learn more about our AI solutions for the window manufacturing industry, please visit our website or contact us through the channels listed there.

Acknowledgments

  • YOLOv7 implementation by WongKinYiu
  • Training infrastructure and annotation tools
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for darius-muc/YOLOv7_Window_Detection_with_Measurements