A Python wrapper on Darknet. Compatible with latest YOLO V3. YOLO 3.0 is a real-time Object Detector by pjreddie.
Image source: http://absfreepic.com/free-photos/download/crowded-cars-on-street-4032x2272_48736.html
- 2019-01-15 - Added nvidia-docker support.
- 2018-08-04 - Option to select the preferred GPU -
pydarknet.set_cuda_device(GPU_INDEX)
- 2018-04-23 - PyPI Release of RC12
- Python 3.5
- Python3-Dev (For Ubuntu,
sudo apt-get install python3-dev
) - Numpy
pip3 install numpy
- Cython
pip3 install cython
- Optionally, OpenCV 3.x with Python bindings. (Tested on OpenCV 3.4.0)
- You can use this script to automate Open CV 3.4 installation (Tested on Ubuntu 16.04).
- Performance of this approach is better than not using OpenCV.
- Installations from PyPI distributions does not use OpenCV.
NOTE: OpenCV 3.4.1 has a bug which causes Darknet to fail. Therefore this wrapper would not work with OpenCV 3.4.1.
More details are available at https://github.com/pjreddie/darknet/issues/502
Installation from PyPI distribution (as described below) is the most convenient approach if you intend to use yolo34py for your projects.
pip3 install yolo34py
pip3 install yolo34py-gpu
NOTE: PyPI Deployments does not use OpenCV due to complexity involved in installation.
To get best performance, it is recommended to install from source with OpenCV enabled.
NOTE: Make sure CUDA_HOME environment variable is set.
- If you have not installed already, run
python3 setup.py build_ext --inplace
to install library locally. - Download "yolov3" model file and config files using
sh download_models.sh
. - Run
python3 webcam_demo.py
,python3 video_demo.py
orpython3 image_demo.py
- Navigate to docker directory.
- Copy sample images into the
input
directory. Or else run input/download_sample_images.sh - Run
sh run.sh
orsh run-gpu.sh
- Observe the outputs generated in
output
directory.
GPU Version requires nvidia-docker
- Set environment variables
- To enable GPU acceleration,
export GPU=1
. - To enable OpenCV,
export OPENCV=1
- Navigate to source root and run
pip3 install .
to install library.
- Set environment variable DARKNET_HOME to download location of darknet.
- Add DARKNET_HOME to LD_LIBRARY_PATH.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DARKNET_HOME
- Continue instructions for installation from source.
Kindly raise your issues in the issues section of GitHub repository.
Feel free to send PRs or discuss on possible future improvements in issues section. Your contributions are most welcome!