The Video Classifier incorporates TensorFlow's machine learning capabilities to actively analyze video streams detect specific categories.
- Python 3
- TensorFlow
- OpenCV
- Clone the repository to your local machine.
- Copy the
tf_files
folder with your model to/Models/tf_files-v{1.0}
replacing the brackets with your own version number. - Navigate into the
VideoClassifier
directory using the command line. - Run
python3 TornadoServer.py [model_version]
, replacing the brackets with your model version number to execute the server. - Navigate to
http://localhost:8080
to get the test the web application for classification.
- Clone the repository to your local machine.
- Copy the training images onto the
Models/tf_files-v{1.0}/cnn/dataset
directory. Make sure all image files are divided into different folders, each folder named with the associated category/label. - Navigate into the
VideoClassifier
folder with the command line. - Execute the
Trainer.py
script withcnn
option followed by your version number. Ex:python Trainer.py cnn 1.0
- The script will start the retraining process and save your model under
tf_files-v{1.0}/retrained_graph.pb
.
Disclaimer: The VideoClassifier/tf_scripts
folder is sourced from the official TensorFlow repo. It contains helper scripts for training and classifying, and is provided within for convenience, to avoid having to clone the entire repository.
- Clone the repository to your local machine.
- Copy the training video frames onto the
VideoClassifier/Models/tf_files-v{1.0}/rnn/dataset
directory. - Run the
Trainer.py
script using thernn
option followed by your model version number. Ex:python Trainer.py rnn 1.0
- The script will start pre-processing the data, and then initiate the training process, saving your model under
tf_files-v{1.0}/rnn-model/lstm-model
.
Note: The training process may take extremely long time periods depending on the size of your dataset. It is recommended to run on powerful machines, preferrably using NVIDIA GPUs with an optimized version of TensorFlow.
- Organize all videos into different folders, each with a unique category name to be recognized.
- Copy all videos to be classified onto
Models/tf_files-v1.0/videos
using the version number desired. - Navigate into
DatasetToolkit/
using the command line and executepython3 VideoClassifier.py (category) (model_version) (mode) [interval]
, replacing(category)
with the unique category name of videos to classify,model_version
with the model value on yourtf_files-v1.0
folder, andmode
withcnn
orrnn
, depending on the purpose of the dataset.
Usage: python3 VideoClassifier.py (category) (model_version) [mode][state] [interval]
P- Pause
Space - Toggle Adding Frames to Dataset
+ Increase Playback Speed
- Decrease Playback Speed
S - Save
**Q **- Quit
-
Organize all videos into different folders, each with a unique category name to be recognized.
-
Copy all videos to be classified onto
Models/tf_files-v1.0/videos
using the version number desired. -
Navigate onto
DatasetToolkit
using a command line and executepython3 VideoFragmenter.py (category) (mode)
, replacing category with the desired category to fragment into frames, andcnn
orrnn
for mode, depending on the usage for the dataset. The toolkit will go through every frame for the defined category (category must be present as a folder in
Models/tf_files-v1.0/videos
folder) and extract each frame into a.jpg
file to theModels/tf_files-v1.0/dataset/(MODE)/
folder, mode being eithercnn
orrnn
.
Models are saved as tf_files-v1.0
folders under the Model parent folder.
Python-based TensorFlow programs with socket and HTTP servers for classifying images and videos into their distinctive categories and training new CNN and RNN models.
Python based tools to manage video, image frames, and classify into respective categories for effective generation of structured training and validation data sets.
To install the dependencies, use the requirements.txt file supplied. Running pip install -r requirements.txt
will install all necessary dependencies for the system.
- TensorFlow
- TFLearn
- Scikit-learn
- OpenCV
- Numpy
- Scipy
- tqdm - Progress bar support
- UCF Crime Dataset - http://crcv.ucf.edu/cchen/
- TensorFlow for Poets 2 Repo: https://github.com/googlecodelabs/tensorflow-for-poets-2