YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
YOLOv7 Window Detection (Without Measurements)
A YOLOv7 model fine-tuned for detecting window frames in technical drawings (specifically trained to detect windows without considering measurement text association).
Model Description
This model is a fine-tuned YOLOv7 object detector specialized for the window manufacturing industry. It automatically detects and locates window frames in order documents, proposals, and technical drawings.
Unlike our sibling model "with Measurements", this version focuses purely on the window geometry/frame itself.
Model Type: Object Detection (YOLOv7)
Industry: Window Manufacturing & Installation
Task: Window boundary detection in technical drawings
Classes: 1 (window)
Training Data
The model was trained on a custom dataset of technical drawings.
- Source:
windows-frames2dataset run - Image Types: Scanned technical drawings, floor plans, and technical construction documents
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:
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('windows_without_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}")
cv2.rectangle(img0, (int(xyxy[0]), int(xyxy[1])),
(int(xyxy[2]), int(xyxy[3])), (0, 255, 0), 2)
License
This model is released under the GPL-3.0 License (inherited from YOLOv7).
Contact
Developed by: Modernaus Ugdymo Centras (MUC)
Website: https://muc.lt