Skip to content

Use CNN deep learning model to train and predict the parking lot positions.

Notifications You must be signed in to change notification settings

ZeLiu369/Computer_Version_Parking_Lot_Detection

Repository files navigation

COMP 4301 Computer Version Project


Process overview:

  1. Proceesing the image => Locate the parking lot.
  2. train the CNN model => use model to detect

Image processing:

1. Test image

  1. Suppose we have an image of the parking lot that we can use to evaluate the accuracy of our parking lot detection algorithm.

    image
    • This data is a single frame extracted from the video captured by the camera.

2. Keep the white and yellow part:

  1. As shown in the image, the parking space lines are marked in yellow. Therefore, we aim to preserve the yellow lines while converting all other colors to black and white. To achieve this, we will use white and yellow masks to filter out the background.

    image

    inspired by:

    How to define a threshold value to detect only green colour objects in an image with Python OpenCV?

    How to detect two different colors using cv2.inRange in Python-OpenCV?

3. Convert the image to gray scale

image

4. use openCV Canny method to detect edges:

image

5. Crop Parking lot spaces

image

We crop out any parts of the image that are not related to the actual parking lot. For more accurate and precise calculations and predictions down the line.

6. Hough line transform:

image

At this point we now will use hough line transform to find straight lines within our previously detected edges to find and locate likely spots for parking.

7. Identify rectangular blocks of parking:

image Here we pretty much use what we found from the last step to mark areas for parking blocks. This gives us a more focused area to specifically work on from this step forward.

8.Identify each spot and count num of parking spaces:

image

Here we mark and identify the different parking spots found within the lot based on the width of the lines we previously found within the areas we defined. Here like many spots in the code we opted to visualize an output for testing purposes and to better explain the methods.

9. Crop spot images for CNN model (using code and data pre-processing steps before), and train the CNN model

image

image

CNN parameters:

We build on the top of VGG16 with some hyper-parameters:
batch_size = 32
epochs = 15
activation = softmax
optimizers.SGD(lr=0.0001, momentum=0.9)

The model training and testing loss:

image

10. After all our different methods being executed we finally get our final result which predicts and highlights all the available parking spots as well as the total amount of parking spots within the lot that the neural network found.

image

For every frame of the video, used for result testing.

About

Use CNN deep learning model to train and predict the parking lot positions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published