Git Product home page Git Product logo

pyyolo's Introduction

pyyolo

A Python Wrapper for Yolo

Requirements

This application is tested on Ubuntu 64bit environment. Tested in python2 environment. I have added typing support also. Therefore you will get function suggestions when you using this library with an IDE.

You will need git and make in order to build this application.

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install git-core

Then you will need numpy and opencv-python packages as 3rd party python packages. You can build OpenCV from sources for python and C++ and enable OpenCV while building darknet (Recommended way).

Or you can install OpenCV directly from pip. Then you won't be able to build darknet with OpenCV

pip install opencv-python

Building and Installing

First you need to download and build darknet.

git clone https://github.com/Ramesh-X/pyyolo.git
cd pyyolo
python setup.py build_ext

This will download darknet from its original repository and build the shared library.

You can pass the following additional options while you building the darknet sources.

# To provide custom darknet location
# If you did not provide this, darknet will be downloaded to current location
DARKNET_HOME=/home/user/darknet python setup.py build_ext

# To force rebuilding sources
REBUILD=1 python setup.py build_ext

# To enable OpenCV
OPENCV=1 python setup.py build_ext

# To enable GPU
GPU=1 python setup.py build_ext

# To enable OpenMP
OPENMP=1 python setup.py build_ext

# To enable cuDNN
CUDNN=1 python setup.py build_ext

# You can combine more than one option for building.
CUDNN=1 GPU=1 python setup.py build_ext

Then you can install the pyyolo to the system by:

pip install -U .

Examples

The detect function in darknet can be used to run YOLO models. Similar function is defined in pyyolo module also.

I have given an example code on how to use this with YOLO. First you need to download YOLO weights, cfg files and meta files. YOLO weights can be downloaded from their website. Other files comes with darknet.

You will need to install OpenCV to run this example.

You can download the example code and change the names_filepath, cfg_filepath and weights_filepath. Then get your image which you will need to detect objects and give its path to image_filepath.

You can run the code by python example.py to visualize the output.

Same way, example2.py is there to test this on videos.

pyyolo's People

Contributors

ramesh-x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pyyolo's Issues

ModuleNotFoundError

Hi, I am trying to use this wrapper on a Jetson Nano.

Trying to use Python 2.7 there is a problem that the "enum" module is not found. Using "pip install enum34" I find that I have it installed for python 3.6.

Trying to do the whole process using Python 3.6 the problem is that the "yolo_data" module is not found.

Do you know if there is any fix for this?

Can't build with GPU

When trying to build with GPU the following error happens:

cp: cannot stat 'libdarknet.so': No such file or directory

What can be done to solve that?

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.