CoolFace
Apppublic

egorkoriakov/floor-plan-contour

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
App README

Service C — Building Contour Detector

Detects the outer contour of a building from a floor plan image. Returns a single normalized polygon that bounds the entire building.

Role in the Pipeline

Image → [Service C: contour] → ROI mask
                                  ↓
              [Service A: walls/openings] (masked input)
                                  ↓
                          [Service B: rooms]

The contour is used downstream to:

  • Mask the input image so structural detection (Service A) ignores background.
  • Clip empty-space search in room detection (Service B).
  • Validate that detected rooms lie inside the building.

Endpoints

GET /health

json
{ "status": "healthy", "model_loaded": true, "model_path": "/app/models/best.pt" }

POST /detect-contour

Request (multipart/form-data):

FieldTypeDefaultDescription
fileimageFloor plan PNG/JPEG.
confidencefloat0.30YOLO confidence threshold.

Response:

json
{
  "metadata": { "width": 1024, "height": 768 },
  "contour": {
    "id": "contour_1",
    "type": "building",
    "polygon": [{ "x": 0.05, "y": 0.10 }, ...],
    "confidence": 0.94
  },
  "bbox": { "minX": 0.05, "minY": 0.10, "maxX": 0.95, "maxY": 0.90 }
}

Polygon coordinates are normalized to [0, 1] relative to image dimensions so downstream services can re-apply them at any resolution.

Local Development

bash
docker-compose up --build
curl -F "file=@floor_plan.png" http://localhost:8002/detect-contour

Hugging Face Space Deployment

This directory is structured as a Docker SDK HF Space. Push to a HF Space repo and it will auto-build and expose port 7860.