Tuesday, November 26, 2019

Behavior Recognition System Based on Convolutional Neural Network

Our this article is on this research paper . 
Credit : Bo YU

What we will do ?

We build a set of human behavior recognition system based on the convolution neural network constructed for the specific human behavior in public places. 

(i) : Firstly, video of human behavior data set will be segmented into images, then we process the images by the method of background subtraction to extract moving foreground characters of body. (ii). Secondly, the training data sets are trained into the designed convolution neural network, and the depth learning network is constructed by stochastic gradient descent.
(iii). Finally, the various behaviors of samples are classified and identified with the obtained network model, and the recognition results are compared with the current mainstream methods. The result show that the convolution neural network can study human behavior model automatically and identify human’s behaviors without any manually annotated trainings. 

Human behavior recognition is mainly divided into two processes: the identification and understanding of human behavior feature extraction and motion .

This algorithm is mainly composed of three parts, 
1.  Video pretreatment, 2. Model training 3. Behavior recognition part. 


In the video preprocessing part, firstly the original behavior of video preprocessing, using block updating background subtraction method to achieve target detection, two value image motion information is extracted, then the image input channel convolutional neural network, through the iterative training parameters of the network, to construct a model for convolution Behavior Recognition . Finally, you can use this network to identify human behavior .




Implementation Code on Github : Code


Thursday, November 14, 2019

Frame Extraction From Multiple Videos @x fps (Frame Per Second) In Python

Our this article is extension of previous article .In this article we will extract frame from multiple videos having same length duration .

We are assuming the following conditions :

1. All Videos should have same length duration .

In Our Below code you only need to give path location of videos .

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 14 09:47:58 2019

@author: Jo
"""
#Doing with open cv2
#Import Cv2 library
import numpy as np
import cv2,os
from moviepy.editor import VideoFileClip

#location of the input files
inputfilepaths=["Dataset/big1.mp4","Dataset/big2.mp4","Dataset/big3.mp4","Dataset/big4.mp4"
                ,"Dataset/big5.mp4","Dataset/big6.mp4","Dataset/big7.mp4"]

#For saving output 
if not os.path.exists('Frames'):
    os.makedirs('Frames')

video=[]
#location of video file
for x in range(0,len(inputfilepaths)):
    video.append(cv2.VideoCapture(inputfilepaths[x]))
    print(x+1,"Video length ",VideoFileClip(inputfilepaths[0]).duration,"seconds")

def extractframe(sec):
    # cap.set(cv2.CAP_PROP_POS_MSEC,sec*1000) is responsible for
    #skipping directly to the sec in the video (sec*1000th millisecond)
  
        #reading frame
    hasframes=np.array([])

    for x in range(0,len(video)):
        video[x].set(cv2.CAP_PROP_POS_MSEC,sec*1000)
        hasimage,images=video[x].read()
        hasframes=np.append(hasframes,hasimage)
     
    if hasframes[len(hasframes)-1]:
        #Write to location , increasing the count to avoid name conflict of immges
        for x in range(0,len(video)):
             hasimage,images=video[x].read()
             cv2.imwrite("Frames/{0}video{1}.jpg".format(x+1,count), images)

    return hasframes[len(hasframes)-1]

#starting from 0th second
sec = 0
#Setting fps , here it will capture image in each 0.5 second , 2fps
frameRate = 0.5
count=1

#to check whether frame are their in video or not.
success = extractframe(sec)
while success:
    #increasing counter to name conflick
    count = count + 1
    #setting sec
    sec = sec + frameRate
    sec = round(sec, 2)
    print(sec)
    success = extractframe(sec)
 

*----------------------------------------------------------      
Github Link : 

Frame Extraction From Video @x fps (Frame Per Second) In Python

Video is collection of Frames . In this article we will know how to extract frames from video @x fps(Frame per second) using Python . 

A frame is one of the many still images which compose the complete moving picture . When the moving picture is displayed, each frame is flashed on a screen for a short time (nowadays, usually 1/24, 1/25 or 1/30 of a second) and then immediately replaced by the next one

The frame is also sometimes used as a unit of time, so that a momentary event might be said to last six frames, the actual duration of which depends on the frame rate of the system, which varies according to the video or film standard in use. In North America and Japan, 30 frames per second (fps) is the broadcast standard, with 24 frames/s now common in production for high-definition video shot to look like film. In much of the rest of the world, 25 frames/s is standard.

Below code is extracting frame from video @ 2 fps .

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 14 09:47:58 2019

@author: Jo
"""
#Doing with open cv2
#Import Cv2 library
import cv2,os
from moviepy.editor import VideoFileClip

inputfilepath="Dataset/vid1.mov"

#For saving output 
if not os.path.exists('Frames'):
    os.makedirs('Frames')

#location of video file
video=cv2.VideoCapture(inputfilepath)

#For Getting Clip duration
clip = VideoFileClip(inputfilepath)
print(clip.duration,"seconds")

def extractframe(sec):
    # cap.set(cv2.CAP_PROP_POS_MSEC,sec*1000) is responsible for
    #skipping directly to the sec in the video (sec*1000th millisecond)
    video.set(cv2.CAP_PROP_POS_MSEC,sec*1000)
    #reading frame
    hasframes,image = video.read()
       
    if hasframes:
        #Write to location , increasing the count to avoid name conflict of images
        #
        cv2.imwrite("Frames/image"+str(count)+".jpg", image)  # save frame as JPG file
      
    return hasframes

#starting from 0th second
sec = 0

#Setting fps , here it will capture image in each 0.5 second , 2fps
frameRate = 0.5
count=1

#to check whether frame are their in video or not.
success = extractframe(sec)
while success:
    #increasing counter to name conflick
    count = count + 1
    #setting sec
    sec = sec + frameRate
    sec = round(sec, 2)
    print(sec)
    success = extractframe(sec)

      
Code at Github
*********************************************
Next Article :
Frame Extraction From Multiple Videos @x fps (Frame Per Second) In Python

Tuesday, November 12, 2019

The WILDTRACK Multi-Camera Person Dataset


 Our this article is on this research paper . For more click here .

Abstract of the paper

People detection methods are highly sensitive to the perpetual occlusion among the targets . As multi-camera set-ups become more frequently encountered , joint exploitation of the across views information would allow for improved detection performances . We provides a large-scale HD dataset named WILDTRACK which finally makes advanced deep learning methods applicable to this problem .

In summary , we overview existing , multi-camera datasets and detection methods , enumerate details of our dataset , and we benchmark multi-camera state of the art detectors on this new dataset .

Introduction

Pedestrian detection is sub-category of object detection . Despite the remarkable recent advances , notably lately owning to the integration of the deep learning methods , the performance of these monocular detectors remains limited to medium level occluded applications at the maximum . This statement is legitimate , since given the monocular observation , the underlying cause , in our case the persons to identify , under highly occluded scenes is ambiguous . 

Genuinely, multi-camera detectors come at hand . In general , simple averaging of the per-view predictions , can only improve upon a single view detector . Further, more sophisticated methods jointly make use of the information to yield a prediction . 

In summary :

1. Provided dataset  larger scale HD dataset advantages are : 
-Multi-View detection
-Monocular detection
-Camera calibration

2. We provide experimental benchmark results on this dataset of state of the art multi-camera detection methods .

3. We give an overview of the existing methods and datasets and we discuss research directions .
 
Reference
https://www.epfl.ch/labs/cvlab/data/data-wildtrack/

Behavior Recognition System Based on Convolutional Neural Network

Our this article is on this  research paper .  Credit : Bo YU What we will do ? We build a set of human behavior recognition syste...