StefansAI / Yolov8_Rpi5_CoralUSB

Install and Test of Yolov8 on Raspberry Pi5 with USB Coral TPU
7 stars 2 forks source link

Problem with installation #2

Open Ildaron opened 2 months ago

Ildaron commented 2 months ago

Hi Stefans, thank you for your contribution, I have a problem with installation and wanted to ask, just ti know you are here or not in advance, before writing my full message, currently I use Pi5 in according your installation I receive the next error video 1/1 (frame 181/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 116.7ms video 1/1 (frame 182/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 102.7ms video 1/1 (frame 183/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 107.1ms video 1/1 (frame 184/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 121.3ms video 1/1 (frame 185/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 97.2ms video 1/1 (frame 186/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 115.3ms video 1/1 (frame 187/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 92.2ms video 1/1 (frame 188/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 127.5ms video 1/1 (frame 189/21123) /home/ildaron/GardenCam224.mp4: 192x224 (no detections), 106.3ms video 1/1 (frame 190/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 105.7ms video 1/1 (frame 191/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 149.0ms video 1/1 (frame 192/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 102.0ms video 1/1 (frame 193/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 112.7ms video 1/1 (frame 194/21123) /home/ildaron/GardenCam224.mp4: 192x224 2 Gray Squirrels, 107.3ms video 1/1 (frame 195/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 105.0ms video 1/1 (frame 196/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 109.4ms video 1/1 (frame 197/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 98.9ms video 1/1 (frame 198/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 116.2ms video 1/1 (frame 199/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 97.4ms video 1/1 (frame 200/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 118.9ms video 1/1 (frame 201/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 103.4ms video 1/1 (frame 202/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 120.2ms video 1/1 (frame 203/21123) /home/ildaron/GardenCam224.mp4: 192x224 (no detections), 113.5ms video 1/1 (frame 204/21123) /home/ildaron/GardenCam224.mp4: 192x224 (no detections), 96.2ms video 1/1 (frame 205/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 93.5ms video 1/1 (frame 206/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 105.7ms video 1/1 (frame 207/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 117.3ms video 1/1 (frame 208/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 100.7ms video 1/1 (frame 209/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 117.6ms video 1/1 (frame 210/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 99.5ms video 1/1 (frame 211/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 113.3ms video 1/1 (frame 212/21123) /home/ildaron/GardenCam224.mp4: 192x224 (no detections), 94.9ms video 1/1 (frame 213/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 111.5ms video 1/1 (frame 214/21123) /home/ildaron/GardenCam224.mp4: 192x224 (no detections), 125.8ms video 1/1 (frame 215/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 98.5ms video 1/1 (frame 216/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 95.3ms video 1/1 (frame 217/21123) /home/ildaron/GardenCam224.mp4: 192x224 2 Gray Squirrels, 94.4ms video 1/1 (frame 218/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 116.7ms video 1/1 (frame 219/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 94.3ms video 1/1 (frame 220/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 95.1ms video 1/1 (frame 221/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 98.8ms video 1/1 (frame 222/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 111.2ms video 1/1 (frame 223/21123) /home/ildaron/GardenCam224.mp4: 192x224 1 Gray Squirrel, 108.1ms (myenv) ildaron@raspberrypi:~ $ yolo export model=yolov8n.pt format=edgetpu Ultralytics YOLOv8.2.44 🚀 Python-3.11.2 torch-2.3.1 CPU (Cortex-A76) YOLOv8n summary (fused): 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs

PyTorch: starting from 'yolov8n.pt' with input shape (1, 3, 640, 640) BCHW and output shape(s) (1, 84, 8400) (6.2 MB)

TensorFlow SavedModel: starting export with tensorflow 2.17.0...

ONNX: starting export with onnx 1.16.2 opset 17... ONNX: slimming with onnxslim 0.1.32... ONNX: export success ✅ 2.4s, saved as 'yolov8n.onnx' (12.3 MB) TensorFlow SavedModel: starting TFLite export with onnx2tf 1.22.3...

Automatic generation of each OP name started ======================================== Automatic generation of each OP name complete!

Model loaded ========================================================================

Model conversion started ============================================================ saved_model output started ========================================================== saved_model output complete! WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1724189550.344019 5002 devices.cc:76] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support) WARNING: All log messages before absl::InitializeLog() is called are written to STDERR W0000 00:00:1724189551.163461 5002 tf_tfl_flatbuffer_helpers.cc:392] Ignored output_format. W0000 00:00:1724189551.163514 5002 tf_tfl_flatbuffer_helpers.cc:395] Ignored drop_control_dependency. Float32 tflite output complete! I0000 00:00:1724189551.792393 5002 devices.cc:76] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support) W0000 00:00:1724189552.555131 5002 tf_tfl_flatbuffer_helpers.cc:392] Ignored output_format. W0000 00:00:1724189552.555212 5002 tf_tfl_flatbuffer_helpers.cc:395] Ignored drop_control_dependency. Float16 tflite output complete! I0000 00:00:1724189553.194452 5002 devices.cc:76] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support) W0000 00:00:1724189553.924679 5002 tf_tfl_flatbuffer_helpers.cc:392] Ignored output_format. W0000 00:00:1724189553.924759 5002 tf_tfl_flatbuffer_helpers.cc:395] Ignored drop_control_dependency. Dynamic Range Quantization tflite output complete! Input signature information for quantization signature_name: serving_default input_name.0: images shape: (1, 640, 640, 3) dtype: <dtype: 'float32'> W0000 00:00:1724189557.157828 5002 tf_tfl_flatbuffer_helpers.cc:392] Ignored output_format. W0000 00:00:1724189557.157912 5002 tf_tfl_flatbuffer_helpers.cc:395] Ignored drop_control_dependency. fully_quantize: 0, inference_type: 6, input_inference_type: FLOAT32, output_inference_type: FLOAT32 INT8 Quantization tflite output complete! W0000 00:00:1724189587.063911 5002 tf_tfl_flatbuffer_helpers.cc:392] Ignored output_format. W0000 00:00:1724189587.063990 5002 tf_tfl_flatbuffer_helpers.cc:395] Ignored drop_control_dependency. fully_quantize: 0, inference_type: 6, input_inference_type: INT8, output_inference_type: INT8 Full INT8 Quantization tflite output complete! W0000 00:00:1724189617.147356 5002 tf_tfl_flatbuffer_helpers.cc:392] Ignored output_format. W0000 00:00:1724189617.147408 5002 tf_tfl_flatbuffer_helpers.cc:395] Ignored drop_control_dependency. INT8 Quantization with int16 activations tflite output complete! W0000 00:00:1724189675.780378 5002 tf_tfl_flatbuffer_helpers.cc:392] Ignored output_format. W0000 00:00:1724189675.780447 5002 tf_tfl_flatbuffer_helpers.cc:395] Ignored drop_control_dependency. Full INT8 Quantization with int16 activations tflite output complete! TensorFlow SavedModel: export success ✅ 221.5s, saved as 'yolov8n_saved_model' (41.0 MB) Edge TPU: WARNING ⚠️ Edge TPU known bug https://github.com/ultralytics/ultralytics/issues/1185

Edge TPU: export requires Edge TPU compiler. Attempting install from https://coral.ai/docs/edgetpu/compiler/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). 100 1022 100 1022 0 0 2699 0 --:--:-- --:--:-- --:--:-- 2696 OK deb https://packages.cloud.google.com/apt coral-edgetpu-stable main Hit:1 http://deb.debian.org/debian bookworm InRelease Hit:2 http://archive.raspberrypi.com/debian bookworm InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Hit:4 https://packages.cloud.google.com/apt coral-edgetpu-stable InRelease Hit:5 http://deb.debian.org/debian bookworm-updates InRelease Reading package lists... Done
W: https://packages.cloud.google.com/apt/dists/coral-edgetpu-stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details. Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package edgetpu-compiler Edge TPU: export failure ❌ 3.7s: Command 'sudo apt-get install edgetpu-compiler' returned non-zero exit status 100. Traceback (most recent call last): File "/home/ildaron/myenv/bin/yolo", line 8, in sys.exit(entrypoint()) ^^^^^^^^^^^^ File "/home/ildaron/myenv/lib/python3.11/site-packages/ultralytics/cfg/init.py", line 591, in entrypoint getattr(model, mode)(overrides) # default args from model ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ildaron/myenv/lib/python3.11/site-packages/ultralytics/engine/model.py", line 591, in export return Exporter(overrides=args, _callbacks=self.callbacks)(model=self.model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ildaron/myenv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decoratecontext return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/ildaron/myenv/lib/python3.11/site-packages/ultralytics/engine/exporter.py", line 319, in call f[8], = self.export_edgetpu(tflite_model=Path(f[5]) / f"{self.file.stem}_full_integer_quant.tflite") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ildaron/myenv/lib/python3.11/site-packages/ultralytics/engine/exporter.py", line 142, in outer_func raise e File "/home/ildaron/myenv/lib/python3.11/site-packages/ultralytics/engine/exporter.py", line 137, in outer_func f, model = inner_func(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ildaron/myenv/lib/python3.11/site-packages/ultralytics/engine/exporter.py", line 954, in export_edgetpu subprocess.run(c if sudo else c.replace("sudo ", ""), shell=True, check=True) File "/usr/lib/python3.11/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command 'sudo apt-get install edgetpu-compiler' returned non-zero exit status 100. (myenv) ildaron@raspberrypi:~ $

StefanW0815 commented 2 months ago

Hi Ildaron, I just checked via running the script on a fresh SD card. I do get error messages that the edge compiler cannot be installed, but I used Colab for the export as described. From what I see, the GardenCam example for 224 was running ok, but maybe only on the CPU. The errors occur afterwards. Did you run the script or manual out of order? I will check tomorrow and get back to you.