Giter Club home page Giter Club logo

video-object-detection's Introduction

Object Detection from Video Stream

This is a simple client-server application for object detection.

The server receives a video stream from the client through a websocket, processes it using YOLOv3, and returns the number of detected objects and their respective position for each frame.

Requirements

  • Python 3

Installation

  • Clone the repo and install the required Python packages.

    git clone https://github.com/PedroDSFerreira/video-object-detection.git
    cd video-object-detection
    pip install -r requirements.txt

Usage

Server

Without Docker

  1. Open a terminal and navigate to the server directory.

    cd server
  2. Download the YOLOv3 model files and place them in the yolo directory.

    wget https://pjreddie.com/media/files/yolov3.weights -P yolo
  3. Run the server script.

    python main.py --h <host_ip> --p <host_port> --o <object> --conf <conf_thresh> --nms <nms_thresh>
  • <host_ip>: Host ip (default: 127.0.0.1)
  • <host_port>: Host port (default: 8080)
  • <object>: Object to detect (default: person)
  • <conf_thresh>: Confidence threshold (default: 0.6)
  • <nms_thresh>: Non-maximum suppression threshold (default: 0.3)

The list of available objects can be found at server/yolo/coco.names

The server will start listening for incoming connections on the specified port.

With Docker

  1. Pull the Docker image.

  2. Run the Docker container.

    docker run -p <host_port>:8080 ghcr.io/pedrodsferreira/object-detection-server

In OSM cluster

If you want to run the server in an OSM cluster, after you already have the OSM cluster up and running, just run the following commands:

For adding the packages to OSM:

osm nfpkg-create cnf/object_detection_cnf/
osm nspkg-create cnf/object_detection_cnf_ns/

For running the server in the cluster:

osm ns-create --ns_name object_detection_cnf_ns --nsd_name object_detection_cnf_nsd --vim_account <cluster-vim-name-or-id>

Client

  1. Open a terminal and navigate to the client directory.

    cd client
  2. Run the client script.

    python main.py --h <host_ip> --p <host_port>

The client will establish a connection with the server and start sending video frames. The server will process each frame and return the number of detected objects and positions to the client.

Configuration

  • The YOLO model configuration file (yolov3.cfg), weights file (yolov3.weights), and class names file (coco.names) should be placed in the yolo directory.

Feel free to experiment with server/main.py input parameters to optimize object detection based on your specific use case.

Dependencies

License

This project is licensed under the MIT License.

video-object-detection's People

Contributors

pedrodsferreira avatar magalhaesd77 avatar

Watchers

Kostas Georgiou avatar Pedro Escaleira avatar  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.