Fall Detection using CNN architecture

Fall Detection using CNN architecture
Photo by Julien Laureau on Dribbble

Introduction

Fall detection is major problem in healthcare. Old people fall often and there should be immediate aid for them as injury can be series, even lead to the death. In this project, we will use Convolutional Neural Network architecture to detect whether a person has fallen or not in given image.

For this purpose, we use public dataset that contains videos of falling people. Each frame has been given as a picture, and we use 2 videos that makes a total of 240 images. Images can be labelled manually starting by the frame where the fall starts.




Preprocessing

• Importing necessary libraries

• Downloading the train images, unzipping, and deleting zip file

• Reading the train labels

Output:

Reading the Train Labels

• Reading the test labels

Output:

Reading the test labels

Now we will read train and test images from the created folder, read them with cv2 library. Then we will add current train and test images image to train_images and test_images lists and access corresponding label using image name and add it to train_labels and test_labels lists respectively

Output:

Output of Images Shape

We have 240 RGB images with size (96×96), let’s visualize some images that represents fallen and not fallen person

Output:

Visual train image for fall and not fall

Splitting the train data into train and validation sets

Creating our CNN architecture and fit on train data

• Importing necessary functions from Tensorflow library

• Creating a custom function for convolution operation that will help to avoid unnecessary repetition

For our CNN architecture we build 6 blocks that contains convolution layer, ReLU activation which is followed by max pooling layer, then flatten our result, add one dense layer and use sigmoid function for the final result

Output:

Model Summary

To train our model we use Adam optimizer with learning rate= 0.0001 and Binary Crossentropy as loss function. Let’s visualize accuracy and loss plots after running our model for 5 epochs and save our model

Output:

Model Accuracy and Loss

 

Testing our model

Now, it is time to test our model on new images. For this purpose we use 12 images.

Predicting on test images and check the results visually.

Output:

Predicting on test images

Conclusion

In conclusion, we built and trained a deep learning model on public dataset and reached a reasonable accuracy on our performance.

Notebook link: Here

Credit: Kanan Mahammadli

Also Read: Flower Classification using CNN