Skip to content

Instantly share code, notes, and snippets.

@simonw
Last active July 22, 2023 19:05
Show Gist options
  • Save simonw/0f93bec220be9cf8250533b603bf6dba to your computer and use it in GitHub Desktop.
Save simonw/0f93bec220be9cf8250533b603bf6dba to your computer and use it in GitHub Desktop.
How I got darkflow working on my OS X Laptop

How I got darkflow working on my OS X Laptop

Darkflow is a Python 3 tool that makes the Darknet open source neural networks available in Python using Tensorflow.

Here's how I got it working on my laptop:

cd /tmp
git clone https://github.com/thtrieu/darkflow
cd darkflow
virtualenv --python=python3 .venv
source .venv/bin/activate
pip install Cython
pip install numpy
pip install tensorflow
pip install opencv-python
pip install .
python setup.py build_ext --inplace
flow --help
mkdir bin
# Downloaded yolo.weights from http://pjreddie.com/darknet/yolo/
cd bin
wget https://pjreddie.com/media/files/yolo.weights
cd ..
flow --imgdir sample_img/ --model cfg/yolo.cfg --load bin/yolo.weights
open sample_img/out/
mkdir my_photos
# Copied some of my photos to my_photos
flow --imgdir my_photos/ --model cfg/yolo.cfg --load bin/yolo.weights
open my_photos/out/
@b-antczak
Copy link

Worked excellent on my Mac, thanks a lot!

@applepedia
Copy link

applepedia commented Dec 2, 2018

i followed all the above steps but after running python setup.py build_ext --inplace line, it denied me. how to solve this ?
screen shot 2018-12-02 at 1 29 11 pm

@riclombar
Copy link

Works on Ubuntu 18.04. Just make sure to be working in Python 3.6

@RezaSajadian
Copy link

Worked perfectly on my mac, thanks a lot, the only thing is that I need to perform this detection on Video. Can anybody elaborate? Thanks in advance.

@jaypatil0412
Copy link

i followed all the above steps but after running python setup.py build_ext --inplace line, it denied me. how to solve this ?
screen shot 2018-12-02 at 1 29 11 pm

I have solution for u , first install utils for Mac

@Lumi1717
Copy link

When i typed the command flow --help this is the error message

Traceback (most recent call last):
File "/Users/ahlamyusuf/darkflow/.venv/bin/flow", line 4, in
from darkflow.cli import cliHandler
File "/Users/ahlamyusuf/darkflow/.venv/lib/python3.7/site-packages/darkflow/cli.py", line 3, in
from .net.build import TFNet
File "/Users/ahlamyusuf/darkflow/.venv/lib/python3.7/site-packages/darkflow/net/build.py", line 5, in
from .ops import op_create, identity
File "/Users/ahlamyusuf/darkflow/.venv/lib/python3.7/site-packages/darkflow/net/ops/init.py", line 1, in
from .simple import *
File "/Users/ahlamyusuf/darkflow/.venv/lib/python3.7/site-packages/darkflow/net/ops/simple.py", line 1, in
import tensorflow.contrib.slim as slim
ModuleNotFoundError: No module named 'tensorflow.contrib'

@SimitTomar
Copy link

Getting the same error on flow --help

@ebley
Copy link

ebley commented Jun 18, 2020

Being 2 years after the article was written - I used not QUITE the latest version of tensor flow but pip install tensorflow==1.13.* since it seems to be in a lot of tutorials. FINALLY I GOT SOMETHING WORKING to train on my own image set. Thanks dude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment