Skip to content

MatinHosseinianFard/Cyber-Physical-Systems-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robust Parking Space Detection Using Low-Cost Cameras

Overview

This repository contains the implementation of a robust parking space detection system based on global perceptual understanding. The system leverages convolutional neural networks (CNNs) and a transformer-based module called Global Perceptual Feature Extractor (GPFE) to enhance detection accuracy and robustness against lighting variations. The method has been evaluated on CNREXT, PKLot, and ACPDS datasets and compared with results from the original research paper.

Features

  • Low-cost vision-based parking space detection
  • CNN integration with the GPFE module for enhanced feature extraction
  • Evaluation on three benchmark datasets
  • Comparison with state-of-the-art models (ShuffleNetV2, mAlexNet)
  • Implementation using PyTorch
  • Dataset preprocessing, model training, and evaluation scripts included

Datasets

Three benchmark datasets are used in this study:

  1. ACPDS: Contains segmented parking space images with labeled occupancy status.
  2. PKLot: A large-scale dataset with various weather conditions and camera angles.
  3. CNREXT: Features diverse lighting conditions and includes parking lot annotations.

Each dataset has been preprocessed according to the specifications provided in the reference research paper. The dataset segmentation and augmentation procedures are available in the utils/ directory.

Model Architecture

The parking space classification model consists of:

  • ShuffleNetV2 / mAlexNet: Lightweight CNN architectures for image classification.
  • GPFE Module: A transformer-based feature extractor designed to enhance generalization in varying lighting conditions.
  • Data Augmentation: Random cropping and color transformation for better generalization.
  • Loss Function & Optimizer: Uses CrossEntropyLoss with SGD optimizer and a learning rate scheduler.

Model Training

  1. ShuffleNetV2

    • Implemented using torchvision.models.shufflenet_v2_x1_0
    • Custom modifications for binary classification.
  2. mAlexNet

    • Implemented as per the referenced paper specifications.

Training Parameters

  • Batch Size: 64 (Due to resource constraints, 32 was used)
  • Optimizer: SGD with Momentum (0.9) & Weight Decay (0.0005)
  • Learning Rate: 0.001, decayed every 3 epochs by 0.75
  • Epochs: 60
  • Data Augmentation: Random cropping and color jittering

Results

Table 1: Effect of Classification Attentive Module on mAlexNet+GPFE Accuracy

Acc(%) ratio cam layers heads emb batch
74.16 2 True 12 8 256 32
80.54 16 True 12 8 256 32
86.98 - False 12 8 256 32
81.61 8 True 8 8 256 32
85.97 - False 8 8 256 32

Table 2-a: Accuracy, Parameters, and FLOPs Comparison (Implementation Results)

Models FLOPS Params (M) ACPDS (%) PKLot (%) CNREXT (%)
mAlexNet 28.61 0.04 86.91 97.47 96.16
+GPFE 794.54 10.38 86.98 96.71 96.49
Delta +765.93 +10.34 +0.07 -0.76 +0.33
ShuffleNet 197.7 1.26 92.75 98.78 98.99
+GPFE 932.09 11.58 89.26 99.09 98.79
Delta +734.39 +10.32 -3.49 +0.31 -0.20

Table 3-a: Cross-Dataset Evaluation (Implementation Results)

Models Train Dataset Test Dataset Accuracy (%)
mAlexNet PKLot_Train CNR-EXT 85.25
+GPFE PKLot_Train CNR-EXT 82.46
Delta -2.79
ShuffleNet PKLot_Train CNR-EXT 84.39
+GPFE PKLot_Train CNR-EXT 81.75
Delta -2.64

Table 4-a: Cross-Testing on CNREXT Sub-Datasets (Implementation Results)

CNREXT Sub-Dataset Train Dataset Test Dataset ShuffleNet (%) +GPFE (%) Delta (%)
Sunny CNREXT Sunny 98.55 98.74 -0.19
Rainy CNREXT Rainy 97.18 97.53 -0.35
Overcast CNREXT Overcast 98.27 98.48 -0.21

Table 5-a: Cross-Testing on PKLot Sub-Datasets (Implementation Results)

PKLot Sub-Dataset Train Dataset Test Dataset ShuffleNet (%) +GPFE (%) Delta (%)
PUC_test UFPR04_train PUC_test 92.99 92.88 -0.11
UFPR04_test UFPR04_train UFPR04_test 99.69 99.59 -0.10
UFPR05_test UFPR04_train UFPR05_test 90.51 89.13 -1.38
PUC_test UFPR05_train PUC_test 94.00 91.14 -2.86
UFPR04_test UFPR05_train UFPR04_test 88.81 88.13 -0.68
UFPR05_test UFPR05_train UFPR05_test 99.53 99.53 0.00

Table 6-a: Impact of GPFE-CA on Model Performance (Implementation Results)

Models Train Dataset Test Dataset Accuracy (%)
mAlexNet PKLot_Train CNR-EXT 85.25
mAlexNet + GPFE without CA PKLot_Train CNR-EXT 82.46
mAlexNet + GPFE with CA PKLot_Train CNR-EXT 81.58
ShuffleNet PKLot_Train CNR-EXT 84.39
ShuffleNet + GPFE without CA PKLot_Train CNR-EXT 81.75
ShuffleNet + GPFE with CA PKLot_Train CNR-EXT 80.38

Table 7: Model Size Comparison After Quantization

Models TensorFlow Model Size (MB) TensorFlow Lite Model Size (MB)
mAlexNet 0.342 ≈0.1
mAlexNet+GPFE 81 ≈20
ShuffleNetV2 10 ≈3
ShuffleNetV2+GPFE 91 ≈40

Releases

No releases published

Packages

No packages published