I set up a new server with opencv and google coral tpu.
The coral tpu is workin fine when i run the bird foto:
Code: Select all
/coral/pycoral$ python3 examples/classify_image.py \
> --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
--labels test_data/inat_bird_labels.txt \
--input test_data/parrot.jpg
----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
104.6ms
12.0ms
11.7ms
11.9ms
11.8ms
-------RESULTS--------
Ara macao (Scarlet Macaw): 0.75781
Code: Select all
sudo -u www-data /var/lib/zmeventnotification/bin/zm_detect.py --config /etc/zm/objectconfig.ini --debug --eventid 1
01/21/23 15:41:32 zmesdetect[1252] INF ZMLog.py:292 [Setting up signal handler for logs]
01/21/23 15:41:32 zmesdetect[1252] INF ZMLog.py:301 [Switching global logger to ZMLog]
01/21/23 15:41:33 zmesdetect[1252] INF zm_detect.py:284 [---------| app:6.1.28, pyzm:0.3.56, ES:6.1.28
, OpenCV:4.7.0|------------]
01/21/23 15:41:33 zmesdetect[1252] INF utils.py:405 [Reading config from: /etc/zm/objectconfig.ini]
01/21/23 15:41:33 zmesdetect[1252] INF utils.py:410 [Reading secrets from: /etc/zm/secrets.ini]
01/21/23 15:41:33 zmesdetect[1252] DBG2 utils.py:382 [Secret token found in config: !ZM_PORTAL]
01/21/23 15:41:33 zmesdetect[1252] DBG2 utils.py:382 [Secret token found in config: !ZM_USER]
01/21/23 15:41:33 zmesdetect[1252] DBG2 utils.py:382 [Secret token found in config: !ZM_PASSWORD]
01/21/23 15:41:33 zmesdetect[1252] DBG2 utils.py:382 [Secret token found in config: !ZM_API_PORTAL]
01/21/23 15:41:33 zmesdetect[1252] DBG2 utils.py:382 [Secret token found in config: !ML_USER]
01/21/23 15:41:33 zmesdetect[1252] DBG2 utils.py:382 [Secret token found in config: !ML_PASSWORD]
01/21/23 15:41:33 zmesdetect[1252] DBG2 utils.py:382 [Secret token found in config: !PLATEREC_ALPR_KEY]
01/21/23 15:41:33 zmesdetect[1252] DBG1 utils.py:445 [allowing self-signed certs to work...]
01/21/23 15:41:33 zmesdetect[1252] DBG2 utils.py:455 [Now checking for monitor overrides]
01/21/23 15:41:33 zmesdetect[1252] INF utils.py:510 [Ignoring monitor specific settings, as you did not provide a monitor id]
01/21/23 15:41:33 zmesdetect[1252] DBG3 utils.py:522 [Finally, doing parameter substitution]
01/21/23 15:41:33 zmesdetect[1252] INF zm_detect.py:309 [Importing local classes for Object/Face]
01/21/23 15:41:34 zmesdetect[1252] INF zm_detect.py:334 [Connecting with ZM APIs]
01/21/23 15:41:34 zmesdetect[1252] DBG2 api.py:72 [API SSL certificate check has been disbled]
01/21/23 15:41:34 zmesdetect[1252] DBG1 api.py:181 [using username/password for login]
01/21/23 15:41:34 zmesdetect[1252] DBG2 api.py:210 [Using new token API]
01/21/23 15:41:34 zmesdetect[1252] DBG1 api.py:217 [Access token expires on:2023-01-21 17:41:34.443862 [7200s]]
01/21/23 15:41:34 zmesdetect[1252] DBG1 api.py:221 [Refresh token expires on:2023-01-22 15:41:34.444705 [86400s]]
01/21/23 15:41:34 zmesdetect[1252] DBG2 zm_detect.py:349 [mapping legacy ml data from config]
01/21/23 15:41:34 zmesdetect[1252] DBG2 utils.py:125 [Changing detection_mode from all to most_models to adapt to new features]
01/21/23 15:41:34 zmesdetect[1252] DBG2 zm_detect.py:358 [mapping legacy stream data from config]
01/21/23 15:41:34 zmesdetect[1252] DBG1 detect_sequence.py:160 [Resetting models, will be loaded on next run]
01/21/23 15:41:34 zmesdetect[1252] DBG3 detect_sequence.py:637 [Using manual locking as we are only using one model]
01/21/23 15:41:34 zmesdetect[1252] DBG2 Media.py:51 [Media get SSL certificate check has been disbled]
01/21/23 15:41:34 zmesdetect[1252] DBG2 Media.py:99 [Using URL 1 for stream]
01/21/23 15:41:34 zmesdetect[1252] DBG2 Media.py:114 [We will only process frames: ['alarm', 'snapshot']]
01/21/23 15:41:34 zmesdetect[1252] DBG2 Media.py:137 [No need to start streams, we are picking images from http://192.168.178.71/zm/index.php?view=image&eid=1]
01/21/23 15:41:34 zmesdetect[1252] DBG3 Media.py:271 [Reading http://192.168.178.71/zm/index.php?view=image&eid=1&fid=alarm]
01/21/23 15:41:34 zmesdetect[1252] DBG3 api.py:144 [No need to relogin as access token still has 119.99979976666667 minutes remaining]
01/21/23 15:41:34 zmesdetect[1252] DBG3 api.py:272 [make_request called with url=http://192.168.178.71/zm/index.php?view=image&eid=1&fid=alarm payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjc0MzEyMDk0LCJleHAiOjE2NzQzMTkyOTQsInVzZXIiOiJlcyIsInR5cGUiOiJhY2Nlc3MifQ.ZPsKEbG_eUJUzLPmzO7R83MIGdVLuVHwndsp4z5JiLM'}]
01/21/23 15:41:34 zmesdetect[1252] DBG1 detect_sequence.py:654 [perf: Starting for frame:alarm]
01/21/23 15:41:34 zmesdetect[1252] DBG1 detect_sequence.py:664 [Sequence of detection types to execute: ['object']]
01/21/23 15:41:34 zmesdetect[1252] DBG1 detect_sequence.py:669 [============ Frame: alarm Running object detection type in sequence ==================]
01/21/23 15:41:34 zmesdetect[1252] DBG2 detect_sequence.py:178 [Loading sequence: index:0]
01/21/23 15:41:34 zmesdetect[1252] DBG2 detect_sequence.py:179 [Initializing model type:object with options:{'tpu_max_processes': 1, 'tpu_max_lock_wait': 100, 'gpu_max_processes': 1, 'gpu_max_lock_wait': 100, 'cpu_max_processes': 3, 'cpu_max_lock_wait': 100, 'max_detection_size': '90%', 'object_config': '/var/lib/zmeventnotification/models/yolov3/yolov3.cfg', 'object_weights': '/var/lib/zmeventnotification/models/coral_edgetpu/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite', 'object_labels': '/var/lib/zmeventnotification/models/coral_edgetpu/coco_indexed.names', 'object_min_confidence': 0.3, 'object_framework': 'coral_edgetpu', 'object_processor': 'tpu', 'disable_locks': 'no'}]
01/21/23 15:41:34 zmesdetect[1252] ERR detect_sequence.py:182 [Error loading same model variation for object:No module named 'pycoral']
01/21/23 15:41:34 zmesdetect[1252] DBG2 detect_sequence.py:183 [Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/pyzm/ml/detect_sequence.py", line 180, in _load_models
self.models[seq].append(ObjectDetect.Object(options=obj_seq))
File "/usr/local/lib/python3.10/dist-packages/pyzm/ml/object.py", line 33, in __init__
import pyzm.ml.coral_edgetpu as tpu
File "/usr/local/lib/python3.10/dist-packages/pyzm/ml/coral_edgetpu.py", line 17, in <module>
from pycoral.adapters import common
ModuleNotFoundError: No module named 'pycoral'
]
01/21/23 15:41:34 zmesdetect[1252] DBG3 detect_sequence.py:689 [object has a same_model_sequence strategy of first]
01/21/23 15:41:34 zmesdetect[1252] DBG2 detect_sequence.py:770 [We did not find any object matches in frame: alarm]
01/21/23 15:41:34 zmesdetect[1252] DBG3 Media.py:271 [Reading http://192.168.178.71/zm/index.php?view=image&eid=1&fid=snapshot]
01/21/23 15:41:34 zmesdetect[1252] DBG3 api.py:144 [No need to relogin as access token still has 119.99849605 minutes remaining]
01/21/23 15:41:34 zmesdetect[1252] DBG3 api.py:272 [make_request called with url=http://192.168.178.71/zm/index.php?view=image&eid=1&fid=snapshot payload={} type=get query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJab25lTWluZGVyIiwiaWF0IjoxNjc0MzEyMDk0LCJleHAiOjE2NzQzMTkyOTQsInVzZXIiOiJlcyIsInR5cGUiOiJhY2Nlc3MifQ.ZPsKEbG_eUJUzLPmzO7R83MIGdVLuVHwndsp4z5JiLM'}]
01/21/23 15:41:34 zmesdetect[1252] DBG1 detect_sequence.py:654 [perf: Starting for frame:snapshot]
01/21/23 15:41:34 zmesdetect[1252] DBG1 detect_sequence.py:664 [Sequence of detection types to execute: ['object']]
01/21/23 15:41:34 zmesdetect[1252] DBG1 detect_sequence.py:669 [============ Frame: snapshot Running object detection type in sequence ==================]
01/21/23 15:41:34 zmesdetect[1252] DBG2 detect_sequence.py:178 [Loading sequence: index:0]
01/21/23 15:41:34 zmesdetect[1252] DBG2 detect_sequence.py:179 [Initializing model type:object with options:{'tpu_max_processes': 1, 'tpu_max_lock_wait': 100, 'gpu_max_processes': 1, 'gpu_max_lock_wait': 100, 'cpu_max_processes': 3, 'cpu_max_lock_wait': 100, 'max_detection_size': '90%', 'object_config': '/var/lib/zmeventnotification/models/yolov3/yolov3.cfg', 'object_weights': '/var/lib/zmeventnotification/models/coral_edgetpu/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite', 'object_labels': '/var/lib/zmeventnotification/models/coral_edgetpu/coco_indexed.names', 'object_min_confidence': 0.3, 'object_framework': 'coral_edgetpu', 'object_processor': 'tpu', 'disable_locks': 'no'}]
01/21/23 15:41:34 zmesdetect[1252] ERR detect_sequence.py:182 [Error loading same model variation for object:No module named 'pycoral']
01/21/23 15:41:34 zmesdetect[1252] DBG2 detect_sequence.py:183 [Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/pyzm/ml/detect_sequence.py", line 180, in _load_models
self.models[seq].append(ObjectDetect.Object(options=obj_seq))
File "/usr/local/lib/python3.10/dist-packages/pyzm/ml/object.py", line 33, in __init__
import pyzm.ml.coral_edgetpu as tpu
File "/usr/local/lib/python3.10/dist-packages/pyzm/ml/coral_edgetpu.py", line 17, in <module>
from pycoral.adapters import common
ModuleNotFoundError: No module named 'pycoral'
]
01/21/23 15:41:34 zmesdetect[1252] DBG3 detect_sequence.py:689 [object has a same_model_sequence strategy of first]
01/21/23 15:41:34 zmesdetect[1252] DBG2 detect_sequence.py:770 [We did not find any object matches in frame: snapshot]
01/21/23 15:41:34 zmesdetect[1252] DBG1 detect_sequence.py:827 [perf: TOTAL detection sequence (with image loads) took: 139.24 ms to process 1]
01/21/23 15:41:34 zmesdetect[1252] DBG1 zm_detect.py:557 [Closing logs]