Skip to content

Adi-gitX/floor-segmentation-svm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Floor Segmentation using SVM

Project by: Adithya Kammati (230145)


Overview

This project implements a pixel-wise floor segmentation model using Support Vector Machine (SVM) with rich multi-scale features. The model classifies each pixel in an image as either "floor" or "non-floor".

Final Results

  • Accuracy: 96.75%
  • Precision (Floor): 96%
  • Recall (Floor): 98%
  • F1-Score: 97%

Dataset

  • Location: adithya_230145/ folder in Google Drive
  • Images: 10 floor images in various formats (jpg, jpeg, webp)
  • Annotations: COCO JSON format polygon masks (coco_annotations.json)
  • Total Samples: 100,000 pixels (50K floor + 50K non-floor)

Features Extracted (20 per pixel)

Feature Description
RGB (3) Red, Green, Blue color values
HSV (3) Hue, Saturation, Value color space
Grayscale (1) Intensity value
Multi-scale LBP (3) Local Binary Pattern at R=1,2,3
Gaussian Blur (2) Smoothed versions at sigma=2,5
Local Stats (2) Patch mean and standard deviation
Edge Magnitude (1) Sobel edge strength
Spatial Position (2) Normalized x,y coordinates
DoG-like (1) Difference of Gaussians
Color Ratios (2) R-B difference, G/R ratio

Model Architecture

  • Algorithm: Support Vector Machine (SVM)
  • Kernel: RBF (Radial Basis Function)
  • Parameters: C=50, gamma=0.1
  • Scaler: StandardScaler (z-score normalization)

How to Use the Trained Model

import joblib
import cv2
import numpy as np
from skimage.feature import local_binary_pattern
from scipy.ndimage import uniform_filter, gaussian_filter

# Load model and scaler
clf = joblib.load("svm_floor_model_v2.pkl")
scaler = joblib.load("svm_scaler_v2.pkl")

# Extract features from a new image
def extract_features_for_prediction(image):
    # (Same feature extraction as training)
    # Returns feature array for all pixels
    pass

# Predict
features = extract_features_for_prediction(new_image)
features_scaled = scaler.transform(features)
prediction = clf.predict(features_scaled)
mask = prediction.reshape(image_height, image_width)

Files Saved

File Description
svm_floor_model_v2.pkl Trained SVM model
svm_scaler_v2.pkl Feature scaler

Improvement from Baseline

Version Features Accuracy
v1 (Basic) 4 features (LBP + RGB) 73.47%
v2 (Improved) 20 features (multi-scale) 96.75%

Improvement: +23.28%


Future Improvements

  1. Use deep learning (SegFormer, DeepLabV3+) for 98-99% IoU
  2. Add more training images (500+)
  3. Use SAM for auto-labeling
  4. Implement CRF post-processing

References

  • scikit-learn SVM documentation
  • Local Binary Patterns (LBP) for texture
  • COCO dataset format

About

Indoor floor segmentation using SVM with multi-scale features (LBP, HSV, edge detection). Achieves 96.75% accuracy on COCO-format annotated dataset.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors