Introduction to Video classification

Content :

  1. Introduction the deep learning for video classification
  2. Building our own video classifier using python and tensorflow
  3. Training the model 
  4. Evaluating the model
  5. Conclusion

Introduction the deep learning for video classification

On the journey of deep learning we will hear the lots of buzzwords such as NLP, Computer vision and within these fields also there are several areas to explore such as in nlp we have sentiment analysis, text summarization similarly in computer vision we got image classification, object detection and etc. One such part that is not heavily explore as compare to the one mention is video classification which has tremendous potential in itself as videos are everywhere similar to images.

If we consider the data the dimensionality and size point of view, videos are one of the most intriguing information types as datasets, for example, interpersonal organizations or hereditary codes. Video transferring stages, for example, YouTube is gathering gigantic datasets, engaging Deep Learning research. It is estimate that on everyday basis there are around 500 hours of new content is posted on youtube.

that is just the single platform imagine how much data we do have and what kind of cool things we can do such as automating the task of identifying that a particular video belongs to which category which essentially  can help both the uploader and the content consumer as he will get choices and its will be easier for the content creator to label his video if machine is doing for him.

So in this blog we will learn to create our own simple video classifier.

Dataset

For this problem we will be using the classic UFC101 video dataset which essentially contains the the videos of over 100 category and with over 13000 videos of category belonging to  Swimming, Badminton, Wrestling, Olympic, Shooting, Cricket, Football, Tennis, Hockey, Ice Hockey, Kabaddi, WWE, Gymnasium, Weight lifting, Volleyball, Table tennis, Baseball, Formula 1,MotoGP,Chess,Boxing Fencing, Basketball, and many more.

with over so many category and lots of images we got lot of cover but our preprocessing part is already handle for us we will instead of downloading the whole dataset from official UFC101 we will use dataset preprocessed by a kaggler : 

https://www.kaggle.com/ash81197/vid-classification-ucf101/activity

Building our own video classifier for Video Classification

Lets import the required libraries.

After importing the libraries let’s start by accessing the data and reading the data through the keras API image data generator to read images from the folder into the ram

Training the model 

So for training the model we will be using the transfer learning (VGG19) for creating the neural network and modifying it accordingly to suit our requirement. What this does is essentially  it eliminates the need to create our own architecture for the model as this architecture is already created and it works perfectly with several applications seamlessly  and at the end with the function model.summary() we can actually look at the architecture that is created according to our application.

Compiling and training the model

Here with the help of callbacks the model will regulate the validation loss in the model without our need and it will stop training once the validation loss stops decreasing.

Evaluating the model

The above piece of code will help us get a better understanding of our model in general like how test data performed as compared to training results and etc through the graphs. To evaluate the model further we can also use keras inbuilt function model.evaluate() to accuracy in percentage manner.

Conclusion

While following the blog we will understand how we train and evaluate the model from the dataset only but i suggest one must try and find the limitation of the model by testing it  on the real world dataset to get the better idea of the model and how it  works in general. This blog does not go in depth with preprocessing and testing it on the videos as this is beyond the scope of this blog but googling and finding out how to do it is suggested.

written by : Mukut Khandelwal

reviewed by: Vikas Bhardwaj

If you are Interested In Machine Learning You Can Check Machine Learning Internship Program
Also Check Other Technical And Non Technical Internship Programs

Leave a Comment

Your email address will not be published. Required fields are marked *