digitalbrain79 / pyyolo

Simple python wrapper for YOLO.
126 stars 65 forks source link

Guide to making it Anaconda3 compatible #28

Open nitred opened 6 years ago

nitred commented 6 years ago

Environment Setup

I normally use Anaconda3 on Ubuntu 16.04 to manage my environments including Cuda & CUDNN. Create a new file called dev_environment.yml at the root directory of pyyolo. The dev_environment.yml should look like the following:

name: ENV-NAME
channels:
  - defaults
dependencies:
- python=3.5
- cudatoolkit=8
- cudnn=5
- pip:
  - cython

Install and activate the environment:

conda env create --force -f dev_environment.yml
source activate env-name

Changes to Makefile

  1. Set the flags GPU=1 and CUDNN=1 at the top of the Makefile.

  2. Change the location of where cuda can be found. In the Makefile line 40, replace the line: COMMON+= -DGPU -I/usr/local/cuda/include/ with COMMON+= -DGPU -I/home/USER/anaconda3/envs/ENV-NAME/include/

  3. Add an option to prevent the error: /usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope. In the Makefile line 66, replace the line: $(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@ with $(NVCC) -D_FORCE_INLINES $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@

Installing pyyolo

You don't need sudo anymore since we will be using a locally available Anaconda python.

1. git clone --recursive https://github.com/thomaspark-pkj/pyyolo.git
2. Setup Environment (Described above)
3. Changes to Makefile (Described above)
4. make clean
5. make
6. python setup_gpu.py build
7. python setup_gpu.py install

Run Example

python example.py