Giter Site home page Giter Site logo

no-1ne / videoflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from videoflow/videoflow

1.0 1.0 0.0 4.02 MB

Python framework that facilitates the quick development of complex video analysis applications and other series-processing based applications in a multiprocessing environment.

Home Page: https://videoflow.readthedocs.io/en/latest/

License: MIT License

Shell 0.08% Python 99.92%

videoflow's Introduction

Videoflow

Videoflow

Build Status license

Videoflow is a Python framework for video stream processing. The library is designed to facilitate easy and quick definition of computer vision stream processing applications. It empowers developers to build applications and systems with self-contained Deep Learning and Computer Vision capabilities using simple and few lines of code. It contains off-the-shelf components for object detection, object tracking, human pose estimation, etc, and it is easily extensible.

The complete documentation to the project is located in Read the docs.

Installing the framework

Requirements

Before installing, be sure that you have cv2 and tensorflow >= 1.12 already installed.

Installation

You can install directly using pip by doing pip3 install videoflow

Alternatively, you can install by:

  1. Clone this repository
  2. Inside the repository folder, execute pip3 install . --user

Python 2 is NOT SUPPORTED. Requies Python 3.6+

Sample Videoflow application:

Below a sample videoflow applicaiton that detects automobiles in an intersection. For more examples see the examples folder.

import videoflow
import videoflow.core.flow as flow
from videoflow.core.constants import BATCH
from videoflow.consumers import VideofileWriter
from videoflow.producers import VideofileReader
from videoflow.processors.vision.detectors import TensorflowObjectDetector
from videoflow.processors.vision.annotators import BoundingBoxAnnotator
from videoflow.utils.downloader import get_file

URL_VIDEO = "https://github.com/videoflow/videoflow/releases/download/examples/intersection.mp4"

class FrameIndexSplitter(videoflow.core.node.ProcessorNode):
    def __init__(self):
        super(FrameIndexSplitter, self).__init__()
    
    def process(self, data):
        index, frame = data
        return frame

input_file = get_file("intersection.mp4", URL_VIDEO)
output_file = "output.avi"
reader = VideofileReader(input_file)
frame = FrameIndexSplitter()(reader)
detector = TensorflowObjectDetector()(frame)
annotator = BoundingBoxAnnotator()(frame, detector)
writer = VideofileWriter(output_file, fps = 30)(annotator)
fl = flow.Flow([reader], [writer], flow_type = BATCH)
fl.run()
fl.join()

The output of the application is an annotated video:

The Structure of a flow application

A flow application usually consists of three parts:

  1. In the first part of the application you define a directed acyclic graph of computation nodes. There are 3 different kinds of nodes: producers, processors and consumers. Producer nodes create data (commonly they will get the data from a source that is external to the flow). Processors receive data as input and produce data as output. Consumers read data and do not produce any output. You usually use a consumer when you want to write results to a log file, or when you want to push results to an external source (rest API, S3 bucket, etc.)

  2. To create a flow object, you need to pass to it your list of producers and your list of consumers. Once a flow is defined you can start it. Starting the flow means that the producers start putting data into the flow and processors and consumers start receiving data. Starting the flow also means allocating resources for producers, processors and consumers. For simplicity for now we can say that each producer, processor and consumer will run on its own process space.

  3. Once the flow starts, you can also stop it. When you stop the flow, it will happen organically. Producers will stop producing data. The rest of the nodes in the flow will continue running until the pipes run dry. The resources used in the flow are deallocated progressively, as each node stops producing/processing/consuming data.

videoflow's People

Contributors

jadielam avatar no-1ne avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.