Closed apsilva closed 5 days ago
Hi,
Just want to share my solution to running usb coral tpu on debian 12.
# install google repos and libedgetpu1-std echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - apt update apt install libedgetpu1-std # install python 3.9.18 (pycoral fails to install with system python3.11) wget https://www.python.org/ftp/python/3.9.18/Python-3.9.18.tgz tar -zxf Python-3.9.18.tgz python3.9 -m pip install --extra-index-url https://google-coral.github.io/py-repo/ pycoral~=2.0 python3.9 -m pip install opencv-python python3.9 -m pip install "numpy<2.0" git clone https://github.com/ZoneMinder/zmeventnotification.git cd zmeventnotification # replace python3 to python3.9 find . -type f -name "*.py" -exec sed -i 's/#!\/usr\/bin\/python3/#!\/usr\/local\/bin\/python3.9/g' {} + PYTHON=python3.9 PIP='pip3.9' INSTALL_CORAL_EDGETPU=yes ./install.sh
Need to fix pyzm ml coral edgetpu detection:
diff -Nur /usr/local/lib/python3.9/site-packages/pyzm-orig/ml/coral_edgetpu.py /usr/local/lib/python3.9/site-packages/pyzm/ml/coral_edgetpu.py --- /usr/local/lib/python3.9/site-packages/pyzm-orig/ml/coral_edgetpu.py 2024-11-14 11:01:13.412944642 +0000 +++ /usr/local/lib/python3.9/site-packages/pyzm/ml/coral_edgetpu.py 2024-11-14 11:09:35.885344529 +0000 @@ -165,7 +165,7 @@ .format(Width, Height)) t= Timer() _, scale = common.set_resized_input( - self.model, img.size, lambda size: img.resize(size, Image.ANTIALIAS)) + self.model, img.size, lambda size: img.resize(size, Image.LANCZOS)) self.model.invoke() objs = detect.get_objects(self.model, float(self.options.get('object_min_confidence')), scale) diff -Nur /usr/local/lib/python3.9/site-packages/pyzm-orig/ml/face_tpu.py /usr/local/lib/python3.9/site-packages/pyzm/ml/face_tpu.py --- /usr/local/lib/python3.9/site-packages/pyzm-orig/ml/face_tpu.py 2024-11-14 11:01:13.416944645 +0000 +++ /usr/local/lib/python3.9/site-packages/pyzm/ml/face_tpu.py 2024-11-14 11:09:01.805317383 +0000 @@ -123,7 +123,7 @@ .format(Width, Height)) t= Timer() _, scale = common.set_resized_input( - self.model, img.size, lambda size: img.resize(size, Image.ANTIALIAS)) + self.model, img.size, lambda size: img.resize(size, Image.LANCZOS)) self.model.invoke() objs = detect.get_objects(self.model, float(self.options.get('face_min_confidence',0.1)), scale)
Thanks.
hi, just discover mlapi, setting up a virtual env. also solves the limitation of using tpu on debian 12. I will use this approach.
Thanks
Hi,
Just want to share my solution to running usb coral tpu on debian 12.
Need to fix pyzm ml coral edgetpu detection:
Thanks.