Saturday, November 9, 2019

Data Science Study Notes: Tutorial to run darkflow

This tutorial is simply to help user without too much computer science background(like me) to run darkflow demo on macbook system.

Step 1: install the following by opening a terminal:

Pip install - upgrade pip 
Pip Install tensorflow
Pip Install opencv-python

2. Download the github repository from the git location:
Simply click the "clone or download" button to manually download the full zip file:, copy that file to your personal working directory, for example, /User/your_user_name/, then unzip that file in the same directory. You will get many file/folder under the folder: darkflow-master folder.

3. Run the following code in your terminal "/User/your_user_name/" to install this software first, otherwise you will get some error message like
"xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1

It means that you need to install XCode command line, open a Terminal and run this command:
xcode-select --install
This will usually take a few mins to install the software.

4. Double check the code in the beginning of the executable file flow.exe:
Previously it might be something like this:
#! /usr/bin/env python
Change that to:
#! /usr/bin/env python3

5. Run the following code to install the module:
python3 build_ext --inplace

At the end of the installation, you should get some message like:
building 'darkflow.cython_utils.nms' extension
copying build/lib.macosx-10.7-x86_64-3.7/darkflow/cython_utils/ -> darkflow/cython_utils
copying build/lib.macosx-10.7-x86_64-3.7/darkflow/cython_utils/ -> darkflow/cython_utils
copying build/lib.macosx-10.7-x86_64-3.7/darkflow/cython_utils/ -> darkflow/cython_utils

You might get some warning message, which is fine; However, if you got some error message, then you probably need to fix it first.

6. Double check to see if you have those weight file in the folder "bin" under your home folder "darkflow-master", otherwise manually go to this place to download the file:
"", choose the last one to download and save to the folder "bin".

7. Once everything is ready, then run the following code to test the demo:
python flow --model cfg/yolo.cfg --load bin/yolo.weights --demo camera 

8. Click Esc on your keyboard to Exit the demo.

Here are two related article on towardsdatascience and medium:

No comments:

Post a Comment

Python Study notes: how do we use Underscore(_) in Python

You will find max six different uses of underscore(_) . If you want you can use it for different purposes after you have an idea about unde...