- A Windows 10 Pro PC
- Preferably a dedicated NVIDIA GPU
- Administrator access to download and install
- Cmder (Download the Full Version)
- Visual Studio Code
- Visual Studio 2015/2017 Visual C++ Build Tool (Follow the install process, The total install is about 1.5gigs)
- Download Anaconda Python 3.6 and run installation with default settings. Note the installation path which will be used in steps 2 and 3
- Add the installation directory path to your Path (either user or system variables) in the Environment Variable settings in System Properties. For us it was
C:\Users\{yourUserName}\AppData\Local\Continuum\anaconda3 - Also add the
.\anaconda3\Scriptsto your Path (either user or system variables) in the Environment Variable settings in System Properties. For us it wasC:\Users\{yourUserName}\AppData\Local\Continuum\anaconda3\Scripts - To test python, run
pythonin your cmder, and you should seePython 3.6.x |Anaconda, Inc. ...and a REPL prompt. - Type
exit()to exit the REPL. - To test pip, run
pip -Vand you should seepip 10.0.x ... - If you have
pip 9.0.xrunpython -m pip install -U pipto update to the latest version.
- What GPU do I have?
- Go to CUDA 9.0 Download - Follow the link to download CUDA 9.0, the latest version of CUDA (9.2) is not supported for Tensorflow yet. See GH Issue
- Pick the right configuration for your machine
- Download the Base Installer (Express option is ok)
- Download Patch 2 (Released Mar 5, 2018) (Express option is ok)
- Download cuDNN for CUDA 9.0 Note: You will need to create a membership account for download access
- Follow the instruction here Note: Complete 4.2 to 4.3, skip 4.3.5 (adding to VS Project)
- With Python, and CUDA/cuDNN installed, run
pip install --upgrade tensorflow-gputo install the GPU Version of Tensorflow. - Check that your machine has successfully installed tensorflow. In cmder run
pythonto open the python repl. - Inside the python repl run
import tensorflow(you may see a float error, this is expected) - Run
print(tensorflow.__version__)and you should see1.8.0 - Run
exit()to exit the python repl
tensorflow-gpu is now downloaded and installed successfully. Note: The following output during installation is okay
notebook 5.4.0 requires ipykernel, which is not installed.
jupyter 1.0.0 requires ipykernel, which is not installed.
jupyter-console 5.2.0 requires ipykernel, which is not installed.
ipywidgets 7.1.1 requires ipykernel>=4.5.1, which is not installed.
- Run
pip install --upgrade opencv-contrib-python - Test the installation by running the python REPL (
python>>>import cv2>>>print(cv2.__version__)). You should see3.4.1
The Object Detection API provides established models optimized for image/video analysis. Developers can modify and train these models to fit their specific needs.
- Anaconda should come with these packages but verify they are installed. To do this run:
pip install Cython pip install pillow pip install lxml pip install jupyter pip install matplotlib - Create a project folder (i.e
C:\Users\{YourUserName}\projects\obj-det-proj) - Go to https://github.com/tensorflow/models and clone this repository (~500mb) into your project folder (i.e
C:\Users\{YourUserName}\projects\obj-det-proj\models)
- Download the protobuf win-zip 3.4.0 file here and extract it in a
protocfolder in your project folder (i.eC:\Users\{YourUserName}\projects\obj-det-proj\protoc) - Go back to
{project}/models/research, and run"C:\Users\{YourUserName}\projects\obj-det-proj\protoc\bin\protoc" object_detection/protos/*.proto --python_out=.
- Go back to your project folder (ie
C:\Users\{YourUserName}\projects\obj-det-proj), we'll denote this path as{project}in this doc going forward. - Clone the Coco API repo by running
git clone https://github.com/cocodataset/cocoapi.git - Go into
{project}/cocoapi/PythonAPI, and open upsetup.pyin VS Code. - Remove the arguments in the
extra_compile_argsarray (line 12), so the line should look likeextra_compile_args=[],Save, and exit. - In the
{project}/cocoapi/PythonAPIdirectory, runpython setup.py build_ext --inplace - You should see
Finished generating code /n copying build\lib.win-amd64-3.6\pycocotools\_mask.cp36-win_amd64.pyd -> pycocotools - In the
{project}/cocoapi/PythonAPIdirectory, runrm -rf buildto remove the build directory - In the
{project}/cocoapi/PythonAPIdirectory, Runcp -r pycocotools ../../models/research/.
Note: folder
cocoapiand foldermodelsshould both be in the same directory
- Go to environement variable settings and create a new variable named
PYTHONPATHwith three values:
- the path of your python.exe
- the path of your
{project}/models/research - path of
{project}/models/research/slim.
Concate the three paths with semi-colons without spaces in between.
For example ours looks like:
C:\Users\{YourUserName}\AppData\Local\Continuum\anaconda3;
C:\Users\{YourUserName}\projects\obj-det-proj\models\research;
C:\Users\{YourUserName}\projects\obj-det-proj\models\research\slim
Restart your cmder (exit and open cmder back up), for the environment variable to take effect.
running
echo %PYTHONPATH%should print something similar:C:\Users\{YourUserName}\AppData\Local\Continuum\anaconda3;C:\Users\{YourUserName}\projects\obj-det-proj\models\research;C:\Users\{YourUserName}\projects\obj-det-proj\models\research\slim
- Go to
{project}/models/research - Run
python object_detection/builders/model_builder_test.py - You should see
...............
----------------------------------------------------------------------
Ran 15 tests in 0.184s
OK
Note: If you see some error with
FutureWarningandfloattypes, it is ok.