Im trying to create a program that can run in pyenv pretty much object detection using picamera2 since the latest python runs at 3.11 i needed to downgrade it to 3.9 and create virtual environment with all needed pacakages pretty much what i just did was to pip freeze all the packages that was installed already and install it in virtual environment with python 3.9 running in it. I needed python3.9 because im using pycoral and usb accelerator which needed a tflite_runtime = 2.5.0post1 that only support python<3.9 thats why i downgraded
So whats happening is this is my testing code just for testing the camera in 3.9 python it works when i use webcam with different code but when i use picamera2 it doesnt
import cv2
from picamera2 import Picamera2
piCam=Picamera2()
piCam.preview_configuration.main.size=(1280,720)
piCam.preview_configuration.main.format="RGB888"
piCam.preview_configuration.align()
piCam.configure("preview")
piCam.start()
while True:
frame=piCam.capture_array()
cv2.imshow("piCam",frame)
if cv2.waitKey(1)==ord('q'):
break
cv2.destroyAllWindows()
(tflite1-env3.9) Hello@raspberrypi:~/tflite1 $ python test.py
[2:06:03.864118919] [3873] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[2:06:03.890471358] [3879] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:06:03.893057458] [3879] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:06:03.893157771] [3879] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:06:03.895444523] [3873] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[2:06:03.921488094] [3882] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:06:03.923760476] [3882] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:06:03.923866937] [3882] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:06:03.932698318] [3873] INFO Camera camera.cpp:1183 configuring streams: (0) 1280x720-RGB888 (1) 2028x1080-SBGGR12_CSI2P
[2:06:03.933344829] [3882] INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-pBCC
It shows this in terminal and doesnt create new window, my opencv is latest as well as picamera2
But then i tried to run the command with python 3.11 which is installed in when i installed the os and just install the opencv also it runs fine
With this info
Hello@raspberrypi:~/tflite1 $ python test py
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
[2:05:01.253563831] [3717] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[2:05:01.280055573] [3720] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:05:01.282257009] [3720] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:05:01.282360508] [3720] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:05:01.284754017] [3717] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[2:05:01.309808090] [3723] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:05:01.311907103] [3723] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:05:01.312035564] [3723] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:05:01.317974327] [3717] INFO Camera camera.cpp:1183 configuring streams: (0) 1280x720-RGB888 (1) 2028x1080-SBGGR12_CSI2P
[2:05:01.318410340] [3723] INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-pBCC
In python 3.11 there is this info
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Which i look online tensorflowlite automatically has xnnpack enabled on newer version but older one doesnt
Since tflite_runtime2.5.0 post1 is old I was finding a way to make it do it like that
So whats happening is this is my testing code just for testing the camera in 3.9 python it works when i use webcam with different code but when i use picamera2 it doesnt
import cv2
from picamera2 import Picamera2
piCam=Picamera2()
piCam.preview_configuration.main.size=(1280,720)
piCam.preview_configuration.main.format="RGB888"
piCam.preview_configuration.align()
piCam.configure("preview")
piCam.start()
while True:
frame=piCam.capture_array()
cv2.imshow("piCam",frame)
if cv2.waitKey(1)==ord('q'):
break
cv2.destroyAllWindows()
(tflite1-env3.9) Hello@raspberrypi:~/tflite1 $ python test.py
[2:06:03.864118919] [3873] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[2:06:03.890471358] [3879] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:06:03.893057458] [3879] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:06:03.893157771] [3879] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:06:03.895444523] [3873] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[2:06:03.921488094] [3882] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:06:03.923760476] [3882] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:06:03.923866937] [3882] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:06:03.932698318] [3873] INFO Camera camera.cpp:1183 configuring streams: (0) 1280x720-RGB888 (1) 2028x1080-SBGGR12_CSI2P
[2:06:03.933344829] [3882] INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-pBCC
It shows this in terminal and doesnt create new window, my opencv is latest as well as picamera2
But then i tried to run the command with python 3.11 which is installed in when i installed the os and just install the opencv also it runs fine
With this info
Hello@raspberrypi:~/tflite1 $ python test py
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
[2:05:01.253563831] [3717] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[2:05:01.280055573] [3720] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:05:01.282257009] [3720] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:05:01.282360508] [3720] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:05:01.284754017] [3717] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[2:05:01.309808090] [3723] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[2:05:01.311907103] [3723] INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media4 and ISP device /dev/media0
[2:05:01.312035564] [3723] INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:05:01.317974327] [3717] INFO Camera camera.cpp:1183 configuring streams: (0) 1280x720-RGB888 (1) 2028x1080-SBGGR12_CSI2P
[2:05:01.318410340] [3723] INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1080-SBGGR12_1X12 - Selected unicam format: 2028x1080-pBCC
In python 3.11 there is this info
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Which i look online tensorflowlite automatically has xnnpack enabled on newer version but older one doesnt
Since tflite_runtime2.5.0 post1 is old I was finding a way to make it do it like that
Statistics: Posted by brikona — Thu May 02, 2024 10:17 am — Replies 0 — Views 19