How to TensorFlow Object Detection on Windows
From Scratch: https://github.com/tensorflow/models
For this guide to work you must have a minimum of Windows version 18362.0
INSTALLS…
Windows Media Feature Pack
Windows N and KN editions do not include Media Feature Pack which is required by OpenCV. If you are using Windows N or KN edition, please install also Windows Media Feature Pack.
https://www.microsoft.com/en-us/download/details.aspx?id=48145
Git
Click the download button and install
Python 3.7
TensorFlow only runs on python 3.7 64 bit
https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64-webinstall.exe
Upgrade PIP
python -m pip install --upgrade pip
Virtualenv
pip install virtualenv
Windows Terminal
Project Setup
cd to where you keep your projects
cd /mnt/c/Users/riodw/projects/
Download the TensorFlow models (this includes the Object Detection models)
git clone https://github.com/tensorflow/models.git
cd to models/
cd models
Start a Virtualenv
virtualenv venv
To begin using the virtual environment, it needs to be activated:
venv\scripts\activate
If you get the error below:
You need to run `Set-ExecutionPolicy RemoteSigned` to fix it
Tensorflow Object Detection API
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md
Install TensorFlow
Object Detection does NOT work with TensorFlow version 2
Have to install most recent version of 1
pip install tensorflow==1.15
Install packages
pip install Cython contextlib2 pillow lxml jupyter matplotlib
Install opencv-python
pip install opencv-python
Install Visual Studio Build Tools
https://go.microsoft.com/fwlink/?LinkId=691126
Install COCO API for windows
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Install Protobuf
https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-win64.zip
Unzip the download
cd to research folder
cd .\research\
Compile model and training parameters using Protobuf
# From tensorflow/models/research/
C:\Users\riodw\protoc-3.11.4-win64\bin\protoc.exe object_detection/protos/*.proto --python_out=.
Testing the Installation
# From tensorflow/models/research/
python object_detection/builders/model_builder_test.py
If it fails to
No module named 'object_detection':
No module named 'object_detection':
1. in models\research directory run the following:
python setup.py build
python setup.py install
2. go to model\research\slim and run the following:
pip install -e .
Update PATH
Open the application “Edit the system environment variables”
or just windows search “PATH”
Click Environment Variables…
Edit the Path
Add:
C:\Users\riodw\AppData\Roaming\Python\Python37\Scripts
C:\Users\riodw\AppData\Roaming\Python\Python37\Scripts\bin
Vehicle Detector
Create vehicle_detector.py
Create grabscreen.py
Install opencv-python
pip install opencv-python
Using Object Detection
Link to All detectable objects:
Create Keys.py
https://gist.github.com/riodw/8e95327569f85f1f8949f4c5b6a44acd.js