A modular video processing pipeline
To use it in your project, add the following to your requirements.txt file:
ntt @ git+https://github.com/centralelyon/ntt.git@main#egg=nttOr import the module (assuming you cloned this repository):
import sys
sys.path.append('../ntt')
from frames.frame_extraction import extract_first_frame
if __name__ == "__main__":
extract_first_frame(video_path_in = "samples/",
video_name_in = "C0005.MP4",
frame_path_out = "samples/",
frame_name_out = "C0005.jpg"
).
├── README.md
├── requirements.txt
├── samples : sample videos, images and data
│ ├── (files)
│ └── ...
├── ntt : the main module
│ ├── README.md
│ ├── __init__.py
│ ├── frames : module for frame extraction
│ │ └── ...
│ ├── ...
│ └── ...
├── .circleci : configuration for CircleCI
│ ├── config.yml
│ └── ...
├── .gitignore
├── Dockerfile
└──Each module structure is as follows:
.
├── ...
├── ntt/
│ ├── name_of_the_module
│ ├── README.md
│ ├── __init__.py
│ ├── name_of_the_module/
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── name_of_the_function1.py
│ │ ├── name_of_the_function2.py
│ │ ├── examples
│ │ │ ├── __init__.py
│ │ │ ├── example_name_of_the_function1.py
│ │ │ └── example_name_of_the_function2.py
│ │ ├── tests
│ │ │ ├── __init__.py
│ │ │ ├── test_name_of_the_function1.py
│ │ │ └── test_name_of_the_function2.py
│ │ └── ...
│ ├── ...
│ └── ...
└── ...Run tests with pytest:
$ pytestThe project is configured to run tests on CircleCI. The configuration file is .circleci/config.yml.
- build the image
docker build -t ntt .
$ docker build -t ntt .- run the image
docker run --rm -v ${PWD}:/app ntt
(rm is to remove the container after it is stopped)
docker ps -a
(shows the list of containers)
- run a custom script
docker run --rm -v ${PWD}:/app ntt python ntt/frames/test/test_frame_extraction.py
- run the image
docker run -v "$(pwd)":/app ntt python ntt/frames/test/test_frame_extraction.py
Example of a pipeline
The general idea is to have a pipeline that looks like this:
- store videos
- loaders
- pre-processors
- analysis(tracking, detection, segmentation, etc.)
- post-processors
- visualizers
- debug/monitoring