bitsy-ai / rpi-object-tracking

Object tracking tutorial using TensorFlow / TensorFlow Lite, Raspberry Pi, Pi Camera, and a Pimoroni Pan-Tilt Hat.
https://medium.com/@grepLeigh/real-time-object-tracking-with-tensorflow-raspberry-pi-and-pan-tilt-hat-2aeaef47e134
MIT License
183 stars 69 forks source link

Headless setup appears may not work with this version #14

Closed Martin2kid closed 4 years ago

Martin2kid commented 4 years ago

Description

Describe what you were trying to get done.: Trying to setup as headless upon boot, so I can use it as a freestanding tracking application.

Tell us what happened, what went wrong, and what you expected to happen.: In headless setup & running autostart (no monitor & keyboard attached), Ran few second & servo moves random with jitter, does not detect and freezes at the end (even when VNC viewer connected, it doesn't show video feed in anyway to begin with)--no detection window can be seen in VNC viewer but Terminal showing only Run-time is running txt.

What I Did

1: Enabled & edited /etc/xdg/lxsession/LXDE-pi/autostart to run --lxterminal -e "/home/pi/rpi-deep-pantilt/detection_start.sh"-- which include script to run "rpi-deep-pantilt track" 2: Ran Raspi-config & set resolution to 1024*768 (note; other setting including default will not even start detect session) 3: Upon "rpi-deep-pantilt track", pan tracks ok but tilt stays still & does not move and stop eventually.

This is terminal output from VNC viewer. INFO: Initialized TensorFlow Lite runtime. Exception in thread Thread-1: Traceback (most recent call last): File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/picamera/camera.py", line 1704, in capture_continuous 'Timed out waiting for capture to end') picamera.exc.PiCameraRuntimeError: Timed out waiting for capture to end

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/detect/camera.py", line 99, in flush for f in self.stream: File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/picamera/camera.py", line 1710, in capture_continuous encoder.close() File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/picamera/encoders.py", line 431, in close self.stop() File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/picamera/encoders.py", line 419, in stop self._close_output() File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/picamera/encoders.py", line 349, in _close_output mo.close_stream(output, opened) File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/picamera/mmalobj.py", line 371, in close_stream stream.flush() File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/picamera/array.py", line 238, in flush self.array = bytes_to_rgb(self.getvalue(), self.size or self.camera.resolution) File "/home/pi/rpi-deep-pantilt/.venv/lib/python3.7/site-packages/picamera/array.py", line 127, in bytes_to_rgb 'Incorrect buffer length for resolution %dx%d' % (width, height)) picamera.exc.PiCameraValueError: Incorrect buffer length for resolution 320x320

Solved! sudo rasps-config advanced--resolution--set to DMT Mode 82 1920*1080--save--restart sudo nano /boot/config.txt set frame buffer width 1920 & frame buffer height to 1024--save--restart

this appear new Pi4's HW (HDMI driver) related issue

Martin2kid commented 4 years ago

Solved! sudo rasps-config advanced--resolution--set to DMT Mode 82 1920*1080--save--restart sudo nano /boot/config.txt set frame buffer width 1920 & frame buffer height to 1024--save--restart

this appear new Pi4's HW (HDMI driver) related issue