We are in the process of changing how we classify videos. We are moving away from video based tagging, to tagging parts of the videos where we have recognised there may be an animal. These consist of smaller rectangles of video that are linked together through frames and we call them tracks.
As part of this change, the projects extract.py and classify.py has been updated to use our new python package structure and config files but the rest of the projects have not. At this stage we are not sure whether build.py, train.py and evaluate.py run as we are still refactoring them. (Please use code commited last year (2018) if you want to run these scripts)
These scripts handle the data pre-processing, training, and execution of a Convolutional Neural Network based classifier for thermal vision.
The output is a TensorFlow model that can identify 48x48 video clips centered on the object of interest.
Processes tagged CPTV files extracting targets of interest into track files used for training.
Builds a data set from extracted track files.
Trains a neural net using a provided test / train / validation dataset.
Uses a pre-trained model to identifying and classifying any animals in a CPTV file.
Evaluates the performance of a classify.py run and generates reports.
-
Create a virtual environment and install the necessary prerequisites
pip install -r requirements.txt
-
Copy the classifier_Template.yaml to classifier.yaml and then edit this file with your own settings. You will need to set up the paths for it work on your system. (Note: Currently these settings only apply to classify.py and extract.py)
-
Optionally install GPU support for tensorflow (note this requires additional setup)
pip install tensorflow-gpu
-
MPEG4 output requires FFMPEG to be installed which can be found here. On windows the installation path will need to be added to the system path.
CPTV files can be downloaded using the cptv-downloader tool.
First download the CPTV files by running
python cptv-download.py --user x --password x
Next extract the track files. This can take some time
python extract.py all -v -p
Now we can build the data set
python build.py data
And finally train the model
python train.py -dataset=data -model-name=model --epochs=10
A pre-trained model can be used to classify objects within a CPTV video
python classify.py [cptv filename] -p
This will generate a text file listing the animals identified, and create an MPEG preview file. `