-
Notifications
You must be signed in to change notification settings - Fork 4
NEW! Windows 10 support for TPU
Google only officially supports the TPU on Windows 10. Using it on an IOT class Linux box is preferred, but this is a way to try it.
-
Download python from: https://www.python.org/downloads/windows/ Only 3.5, 3.6, and 3.7 are supported by the Google Coral TPU code. Run the downloaded python-*-amd64.exe to install Python (includes Idle & pip). I used python-3.7.1-amd64.exe
-
Open a command window and run: pip install opencv-contrib-python requests pillow imutils paho-mqtt This installs the extra python modules that I used.
-
Download mosquitto MQTT broker. I used the "quick install" from: http://www.steves-internet-guide.com/install-mosquitto-broker/ Basically just unzip the download and copy the mosquitto folder to a suitable place to install MQTT broker.
-
Start cmd window:
cd to the mosquitto folder location and run:
mosquitto
-
Ctrl-C to stop the broker.
-
Automatically starting it is beyond my Windows pay grade. But the steves-internet-guide site has instructions. I used v1.5.4, but v1.5.8 is current now.
-
-
Download node js from: https://nodejs.org/en/download/ Run the downloaded node-*-x86.msi file to install nodejs and npm. Version node-v12.18.2-x86.msi was current when I installed on Win10.
- If you just want to run the AI and look at detected images later, you can skip this step and the one below, start TPU.py with the --localSave command line option.
-
Install node-red.
-
Open a command window and run:
npm install node-onvif (only needed if you want to try my onvif_discover.js program to find camera snapshot URLS)
npm install --global --production windows-build-tools (optional, I didn't do it)
npm install -g --unsafe-perm node-red
-
Start node-red from the same command window with:
node-red
-
Close the command windwow to exit node-red, this creates the .node-red directory.
-
Install a nodejs package that I use in a function node:
cd .node-red
npm install point-in-polygon
-
Edit: .node-red/settings.js to functionGlobalContext: {} add:
insidePolygon:require('point-in-polygon')
-
Start node-red again from a new command window with:
node-red
-
Open Chrome or Chromium (Edge probably works too) browser tab and connect to: http://localhost/1880
- From the "hamburger" menu dropdown choose: Manage Pallet
- Click the "Install" tab
- In the search modules box, enter
- node-red-node-base64 and click the install button that pops up
- node-red-dashboard and click the install on the one that exactly matches the search string
- node-red-node-email and click the install on the one that exactly matches the search string
- Open the Win10_AI_Controller.json file from the AI distribution in your text editor and copy the contents to the clipboard
- From the node-red menu choose: Import
- paste the clipboard into the dialog that pops up
- press the Import to "current flow" button
- press the red Import button
- position the graphics and and click, then press the red Deploy button next to the menu
- if you get "successfully deployed" there is still configuration to be done, but it should be a starting point.
- Open a new browser tab and connect to: http: localhost:1880/ui This views the "dashboard" which does the basic functions like setting the notification mode, viewing a camera, etc. But nothing will work yet until the AI code is started.
-
-
Install the Google Coral TPU drivers and python interface.
-
Download edgetpu_runtime_20200629.zip from: https://coral.ai/docs/accelerator/get-started/#1c-on-windows
-
Unzip the file and double click the install.bat file.
-
Install tflite-2.1 (see https://www.tensorflow.org/lite/guide/python) with: (assuming python 3.7, use the appropiate version for python 3.5 or 3.6 from the site linked above)
pip install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-win_amd64.whl
-
Install the Visual Studio C runtime redistributable if you don't already have it (VC_redist.x64.exe): https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
-
Install the edgetpu Python module (see https://coral.ai/software#edgetpu-python-api):
pip install https://dl.google.com/coral/edgetpu_api/edgetpu-2.14.0-cp37-cp37m-win_amd64.whl
-
Plug in the Coral TPU USB Accelerator.
-
At this point TPU.py should be ready to go after you've created the cameraURL.txt file for your camera snapshot URLs or a cameraURL.rtsp for RTSP camera streams.
Simply open a command window, cd to the AI directory and run:
python TPU.py
- 5 Onvif 720p cams : ~32.9 fps, probably limited by the rate Onvif snapshots can be had by HTTP requests.
- 4 RTSP HD (1080p) : ~11.8 fps, rtsp streams from the DVR are set for 3 fps each.
- 4 RTSP UHD (4K) : ~12.4 fps, rtsp streams from 4K DVR are set for 3 fps each.
- 5 Onvif, 4 HD (1080p) : ~28.1 fps.
- 4 HD and 4 UHD : ~15.7 fps, this is clearly overloaded.
- 8 HD rtsp streams : ~23.9 fps, basically every frame, much better with HD than UHD streams.
- https://nodered.org/docs/tutorials/
- http://www.steves-internet-guide.com/node-red-overview/
- https://notenoughtech.com/home-automation/nodered-home-automation/nodered-for-beginners-2/