Hi All-
I'm trying to write a program that will run a 300x300 object detection on the Color camera on the oak-1-poe in standalone mode (no host controlling it). For each new detection, I would like it to pass the object name/id to Script, which will then post the result over ethernet to a web server on my laptop on port 8080.
I have this working fine in host mode (when I send the program each time over ethernet to the camera) but it fails if I try to flash it and run it in standalone mode. To get this far, I had to downgrade the bootloader from 0.0.17 to 0.0.15 (otherwise even just HTTP requests are not working for me in standalone mode).
Here is how I downgraded to boot loader 0.0.15:
cd depthai-python
git checkout v2.14.1.0
git submodule update --init --recursive
python3 -m pip install .
I have narrowed down the problem to these 2 lines of code that prevent running in standalone mode (lines 7 and 8 which are commented out below):
test.py
#!/usr/bin/env python3
#For oak-poe-1 camera
import depthai as dai
import time
pipeline = dai.Pipeline()
#nn = pipeline.create(dai.node.MobileNetDetectionNetwork)
#nn.setBlobPath("mobilenet-ssd_openvino_2021.4_8shave.blob") #should be in local directory
script = pipeline.create(dai.node.Script)
script.setProcessor(dai.ProcessorType.LEON_CSS)
script.setScript("""
import http.client
import time
time.sleep(4) #delay needed to make sure tcpip is started
h1 = http.client.HTTPConnection('192.168.33.1', 8080,timeout=1) #send request to a webserver
h1.request("GET", "/NOT/FUBAR")
""")
#add in the code to flash from here:
#https://docs.luxonis.com/projects/api/en/develop/tutorials/standalone_mode/
To test this in host mode, startup another window and run
echo 'HTTP/1.1 200 Hi'|nc -l 192.168.33.1 8080'
(or some other web server - just need to make sure the ip matches the script and is reachable)
Then run the executable script with no arguments (switches to 000011 for ethernet) to run in host mode:
./test.py
[2022-03-18 21:45:35.059] [debug] Python bindings - version: 2.14.1.0.dev+790e6d546f4cb7495e1b5222e1c204697f9d8a11 from 2022-01-11 23:31:23 -0800 build: 2022-03-19 01:07:09 +0000
[2022-03-18 21:45:35.059] [debug] Library information - version: 2.14.1, commit: 0eaab54a7e3415ec135d315dbd33d931475c0097 from 2022-01-11 23:30:55 -0800, build: 2022-03-19 01:07:06 +0000
[2022-03-18 21:45:35.060] [debug] Initialize - finished
Initiating pipeline on device
[2022-03-18 21:45:35.144] [debug] Resources - Archive 'depthai-bootloader-fwp-0.0.15.tar.xz' open: 2ms, archive read: 82ms
[2022-03-18 21:45:35.486] [debug] Resources - Archive 'depthai-device-fwp-f503b7adfd44b696187b7825a12a134ded0ca3f3.tar.xz' open: 2ms, archive read: 424ms
[2022-03-18 21:45:36.392] [debug] Device - OpenVINO version: 2021.4
[2022-03-18 21:45:45.260] [debug] Booting FW with Bootloader. Version 0.0.15, Time taken: 8509ms
...more output...
It works fine and I see the '/NOT/FUBAR' message on the web server that's listening in the other window.
However, if I flash the program onto the camera (by putting this flash code in the program):
import depthai as dai
(f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
bootloader = dai.DeviceBootloader(bl)
progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')
bootloader.flashBootloader(progress)
./test.py
[2022-03-18 21:15:56.763] [debug] Python bindings - version: 2.14.1.0.dev+790e6d546f4cb7495e1b5222e1c204697f9d8a11 from 2022-01-11 23:31:23 -0800 build: 2022-03-19 01:07:09 +0000
[2022-03-18 21:15:56.763] [debug] Library information - version: 2.14.1, commit: 0eaab54a7e3415ec135d315dbd33d931475c0097 from 2022-01-11 23:30:55 -0800, build: 2022-03-19 01:07:06 +0000
[2022-03-18 21:15:56.763] [debug] Initialize - finished
Flashing pipeline for standalone mode
[2022-03-18 21:15:56.847] [debug] Resources - Archive 'depthai-bootloader-fwp-0.0.15.tar.xz' open: 2ms, archive read: 81ms
[2022-03-18 21:15:57.204] [debug] Resources - Archive 'depthai-device-fwp-f503b7adfd44b696187b7825a12a134ded0ca3f3.tar.xz' open: 2ms, archive read: 439ms
Version: 0.0.15
Flashing progress: 1.0%
Flashing progress: 1.7%
...skipping some of the progress output...
Flashing progress: 98.6%
Flashing progress: 99.3%
[2022-03-18 21:19:27.672] [debug] DeviceBootloader about to be closed...
[2022-03-18 21:19:29.674] [debug] XLinkResetRemoteTimeout returned: X_LINK_TIMEOUT
[2022-03-18 21:19:29.674] [debug] XLinkResetRemote of linkId: (0)
[2022-03-18 21:19:29.674] [debug] DeviceBootloader closed, 2002
It looks like it should work, but Standalone mode will fail unless I comment out those 2 lines that load and set the MobileNet neural network.
Also, when it fails, it soft-bricks the camera and no ethernet lights will come on until you factory reset it like this with a usb cable:
Steps I use to reset the OAK-1-POE camera to factory settings:
- unplug camera from Ethernet and from usb
- using a small toothpic, set switches on curcuit board to 010110 which means turn 2,4,5 positions on (1,3,6 off):
- plug-in usb cable from computer to camera (I recommend leaving this cable connected to the camera to avoid braking the connector, only connect as needed from the laptop side)
- run depthai-python/examples/bootloader/factory_reset.py
- unplug usb cable
- set switches on curcuit board to 000011 which means turn 5,6 positions on (1,2,3,4 off):
- plug-in POE ethernet to camera on switch (or poe injector) that connects camera to computer
- look for green lights on the camera’s ethernet port
- ping the ip address of the camera from the computer to ensure it is online
- now you can flash a new standalone program onto the camera
- then powercycle the POE and wait 33 seconds for the click sound- in a few seconds your program will start to run.
Can someone let me know what I can do to get this working? I'm wanting the whole program to boot up and run in the POE camera on its own when it powers up, and then post the inference results out as HTTP GET requests to another machine.
Thanks,
Doug