Our aim was to classify Fighting images vs Non-Fighting images, and we wanted to tackle this problem a bit differently. In this repo, we used the Pose Points of the humans in the images and then trained a Support Vector Machine, Logistic Regressor, Neural Network and a VGG16 based CNN to classify the images. To get the pose points, we used OpenPose, a state-of-the-art pose estimation model. However, since OpenPose was originally written in Caffe, we used a Tensorflow implementation.
The SVM, Logistic Regressor and Neural Network were completely trained using the Pose Points only as the input, while the VGG16 based CNN used both the Pose Points and the image as the input. The features extracted from the image by the VGG16 segment were then concatenated with the Pose Points, and passed through a number of Dense layers.
-
Create a new Python/Anaconda environment (optional but recommended). You might use the
environment.yml
file for this purpose. -
Clone the TF-based OpenPose repo, and set it up.
-
Make sure the folders are arranged in the following manner:-
├─── Fight-NonFight-Classification-OpenPose ├─── .. ├─── docker ├─── etcs ├─── models ├─── scripts ├─── tf_pose ├─── models_info_imgs ├─── saved_models ├─── .. ├─── TrainPosePoints.csv ├─── ValidPosePoints.csv ├─── .. ├─── environment.yml ├─── Run.ipynb ├─── Train.ipynb └─── dataset_imgs ├─── fighting ├─── .. ├─── .. └─── .. (200 images) └─── not_fighting ├─── .. ├─── .. └─── .. (200 images)
Train.ipynb
--> used to train the five different models.Run.ipynb
--> a demo code to extract frames from a video frame and classify them using the VGG16 based CNN.TrainPosePoints.csv
--> contains the pose points of images in the Training set.ValidPosePoints.csv
--> contains the pose points of images in the Validation set.