Project 2 of 4
Computer vision · Application integration · Bachelor's FYP · Early 2025
Floor-plan Processing
Application components for line inference, room segmentation, and editable geometry.
- Role
- Full-stack application and model integration
- Deliverable
- FastAPI room segmentation, a React canvas, and a separate inference wrapper
- Focus
- Uploads · contours · coordinates
Overview
The application repository contains account and file endpoints, a room-segmentation service, and a React canvas. In the separate GLSP repository, a Flask endpoint loads a PyTorch checkpoint and returns predicted line coordinates, confidence scores, and a rendered result.
- Python
- FastAPI
- React / TypeScript
- Ultralytics YOLO
- Flask
- PyTorch
- OpenCV
- NumPy
Walls, doorways, and segment endpoints.
overlay, room_polygons = segment_rooms(file_path)
_, buffer_img = cv2.imencode('.png', overlay)
overlay_base64 = base64.b64encode(buffer_img).decode('utf-8')Separate model-service source
GLSP model-inference API wrapper
The wrapper loads a checkpoint, runs LineVectorizer inference, postprocesses line predictions, and returns image, lines, and scores as JSON. The repository name does not establish original model authorship or a GNN architecture.
GLSP/api.py
Visit the product siteScope
Work completed and source material.Scope and evidence
Scope and contribution.
The FastAPI service handles room segmentation; line inference is in the separate Flask service. The current uploader expects an SVG response from /process/ with a file field, while GLSP/api.py accepts an image field at /process and returns JSON. These public components therefore do not substantiate a verified end-to-end application. The reviewed code also does not substantiate the previous GNN-classification or reproduced-accuracy claims.
backend/app/api/endpoints.py defines account, upload, room-segmentation, and recent-file endpoints.
yolo_segmentation.py runs an Ultralytics YOLO checkpoint, resizes masks, and extracts contours with OpenCV.
FloorPlanUploader.tsx stores room polygons and a base64 overlay returned by the segmentation service.
FloorPlanCanvas.tsx contains vertex, edge, selection, grid, and coordinate-editing interactions.
GLSP/api.py contains a separate Flask/PyTorch inference wrapper; its request and response contract differs from the current uploader.
Problem
Main technical constraint.Problem framing
Image output and geometry need different contracts.
A rendered image, line coordinates, confidence scores, and room contours are different outputs. The application needs explicit request fields and response shapes for each service before those outputs can form one reliable flow.
Implementation
4 implementation steps.Implementation
Follow the boundaries visible in the source.
- Step1
Keep checkpoint loading and line inference in the separate model service.
- Step2
Expose uploads and room segmentation through FastAPI, returning a base64 image and room polygons.
- Step3
Use OpenCV to resize segmentation masks and extract contours in the original image dimensions.
- Step4
Represent editable vertices and edges in the React canvas rather than treating the preview image as the geometry itself.
Result
Inspectable prototype components.
The repositories provide inference-wrapper code, a FastAPI room-segmentation API, and an editable frontend canvas. The remaining contract mismatch is stated explicitly, so these components are presented as a prototype rather than a completed GNN pipeline.
What I learned
The practical next step is to align the uploader with the model service's request and response contract. That is a specific integration task supported by the code.