Error with Coral M.2 TPU and Yolov8 Medium model

aijii

n3wb
Joined
Apr 6, 2021
Messages
1
Reaction score
0
Location
aus
Hi all,

Yesterday I installed a coral m.2 TPU in my proxmox rig and shared it with the Blueiris VM.

It's detected fine, and I've been using it overnight - by default it seems to suck at detections compared to what I had previously, its faster but less accurate. It thinks my pool is an umbrealla and my roller door an airplane.

I guess its very sensitive. I've swapped to the Yolov8 model, and I'm encountering the following errors when I Try to run it with a medium model size:

Code:
11:55:59:Client request 'detect' in queue 'objectdetection_queue' (...d4dcc7)
11:56:00:Update ObjectDetectionCoral. Setting AutoStart=true
11:56:00:Restarting Object Detection (Coral) to apply settings change
11:56:00:Running module using: C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\bin\windows\python39\venv\Scripts\python
11:56:00:
11:56:00:Attempting to start ObjectDetectionCoral with C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\bin\windows\python39\venv\Scripts\python "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py"
11:56:00:Starting C:\Program Files...ws\python39\venv\Scripts\python "C:\Program Files...ectdetection_coral_adapter.py"
11:56:00:
11:56:00:Module 'Object Detection (Coral)' 2.2.0 (ID: ObjectDetectionCoral)
11:56:00:Valid:         True
11:56:00:Module Path:   <root>\modules\ObjectDetectionCoral
11:56:00:AutoStart:     True
11:56:00:Queue:         objectdetection_queue
11:56:00:Runtime:       python3.9
11:56:00:Runtime Loc:   Local
11:56:00:FilePath:      objectdetection_coral_adapter.py
11:56:00:Start pause:   1 sec
11:56:00:Parallelism:   1
11:56:00:LogVerbosity:
11:56:00:Platforms:     all
11:56:00:GPU Libraries: installed if available
11:56:00:GPU Enabled:   enabled
11:56:00:Accelerator:
11:56:00:Half Precis.:  enable
11:56:00:Environment Variables
11:56:00:CPAI_CORAL_MODEL_NAME = YOLOv8
11:56:00:CPAI_CORAL_MULTI_TPU  = True
11:56:00:MODELS_DIR            = <root>\modules\ObjectDetectionCoral\assets
11:56:00:MODEL_SIZE            = medium
11:56:00:
11:56:00:Started Object Detection (Coral) module
11:56:02:objectdetection_coral_adapter.py: MODULE_PATH:           C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral
11:56:02:objectdetection_coral_adapter.py: ERROR:root:TFLite file C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\assets\yolov8m-int8_edgetpu.tflite doesn't exist
11:56:02:objectdetection_coral_adapter.py: MODELS_DIR:            C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\assets
11:56:02:objectdetection_coral_adapter.py: CPAI_CORAL_MODEL_NAME: yolov8
11:56:02:objectdetection_coral_adapter.py: MODEL_SIZE:            medium
11:56:02:objectdetection_coral_adapter.py: CPU_MODEL_NAME:        yolov8m-int8.tflite
11:56:02:objectdetection_coral_adapter.py: Running init for Object Detection (Coral)
11:56:02:objectdetection_coral_adapter.py: TPU detected
11:56:02:objectdetection_coral_adapter.py: TPU_MODEL_NAME:        yolov8m-int8_edgetpu.tflite
11:56:02:objectdetection_coral_adapter.py: Attempting multi-TPU initialisation
11:56:02:objectdetection_coral_adapter.py: An exception occurred initialising the module: local variable 'ex' referenced before assignment

11:56:02:Request 'detect' dequeued from 'objectdetection_queue' (...6e61bf)
11:56:02:Request 'detect' dequeued from 'objectdetection_queue' (...ecc02f)
11:56:02:Request 'detect' dequeued from 'objectdetection_queue' (...0f50b6)
11:56:02:Object Detection (Coral): Retrieved objectdetection_queue command 'detect'
11:56:02:Object Detection (Coral): Retrieved objectdetection_queue command 'detect'
11:56:02:Request 'detect' dequeued from 'objectdetection_queue' (...588f78)
11:56:02:Response rec'd from Object Detection (Coral) command 'detect' (...ecc02f)
11:56:02:Object Detection (Coral):  [AttributeError] : Error during main_loop: Traceback (most recent call last):
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\../../SDK/Python\module_runner.py", line 622, in main_loop
    self.update_statistics(output)
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py", line 128, in update_statistics
    self._num_items_found += len(predictions)
AttributeError: 'CoralObjectDetector_adapter' object has no attribute '_num_items_found'
11:56:02:Object Detection (Coral): Retrieved objectdetection_queue command 'detect'
11:56:02:Request 'detect' dequeued from 'objectdetection_queue' (...943e44)
11:56:02:Object Detection (Coral):  [AttributeError] : Error during main_loop: Traceback (most recent call last):
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\../../SDK/Python\module_runner.py", line 622, in main_loop
    self.update_statistics(output)
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py", line 128, in update_statistics
    self._num_items_found += len(predictions)
AttributeError: 'CoralObjectDetector_adapter' object has no attribute '_num_items_found'
11:56:02:Response rec'd from Object Detection (Coral) command 'detect' (...0f50b6)
11:56:02:Object Detection (Coral): Retrieved objectdetection_queue command 'detect'
11:56:02:Request 'detect' dequeued from 'objectdetection_queue' (...d4dcc7)
11:56:03:Response rec'd from Object Detection (Coral) command 'detect' (...588f78)
11:56:03:Object Detection (Coral):  [AttributeError] : Error during main_loop: Traceback (most recent call last):
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\../../SDK/Python\module_runner.py", line 622, in main_loop
    self.update_statistics(output)
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py", line 128, in update_statistics
    self._num_items_found += len(predictions)
AttributeError: 'CoralObjectDetector_adapter' object has no attribute '_num_items_found'
11:56:03:Object Detection (Coral): Retrieved objectdetection_queue command 'detect'
11:56:03:Object Detection (Coral):  [AttributeError] : Error during main_loop: Traceback (most recent call last):
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\../../SDK/Python\module_runner.py", line 622, in main_loop
    self.update_statistics(output)
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py", line 128, in update_statistics
    self._num_items_found += len(predictions)
AttributeError: 'CoralObjectDetector_adapter' object has no attribute '_num_items_found'
11:56:03:Response rec'd from Object Detection (Coral) command 'detect' (...943e44)
11:56:03:Response rec'd from Object Detection (Coral) command 'detect' (...d4dcc7)
11:56:03:Object Detection (Coral):  [AttributeError] : Error during main_loop: Traceback (most recent call last):
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\../../SDK/Python\module_runner.py", line 622, in main_loop
    self.update_statistics(output)
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py", line 128, in update_statistics
    self._num_items_found += len(predictions)
AttributeError: 'CoralObjectDetector_adapter' object has no attribute '_num_items_found'
11:56:04:Client request 'detect' in queue 'objectdetection_queue' (...2dec1b)
11:56:04:Request 'detect' dequeued from 'objectdetection_queue' (...2dec1b)
11:56:04:Object Detection (Coral): Retrieved objectdetection_queue command 'detect'
11:56:05:Object Detection (Coral):  [AttributeError] : Error during main_loop: Traceback (most recent call last):
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\../../SDK/Python\module_runner.py", line 622, in main_loop
    self.update_statistics(output)
  File "C:\Program Files\CodeProject\AI\modules\ObjectDetectionCoral\objectdetection_coral_adapter.py", line 128, in update_statistics
    self._num_items_found += len(predictions)
AttributeError: 'CoralObjectDetector_adapter' object has no attribute '_num_items_found'
11:56:05:Response rec'd from Object Detection (Coral) command 'detect' (...2dec1b)
11:56:08:Update ObjectDetectionCoral. Setting AutoStart=false
11:56:08:Stopping Object Detection (Coral)
11:56:08:Client request 'Quit' in queue 'objectdetection_queue' (...a0f70b)
11:56:08:Request 'Quit' dequeued from 'objectdetection_queue' (...a0f70b)
11:56:08:Sending shutdown request to python/ObjectDetectionCoral
11:56:12:Object Detection (Coral): Retrieved objectdetection_queue command 'Quit'
11:56:12:objectdetection_coral_adapter.py: Object Detection (Coral) started.
11:56:12:objectdetection_coral_adapter.py: no TPU interpreters: Falling back to CPU detection
11:56:12:objectdetection_coral_adapter.py: No interpreter found. Recreating.
11:56:12:objectdetection_coral_adapter.py: Model change detected. Forcing model reload.
11:56:12:objectdetection_coral_adapter.py: Input details: {'name': 'normalized_input_image_tensor', 'index': 0, 'shape': array([  1, 320, 320,   3]), 'shape_signature': array([  1, 320, 320,   3]), 'dtype': , 'quantization': (0.0078125, 128), 'quantization_parameters': {'scales': array([0.0078125], dtype=float32), 'zero_points': array([128]), 'quantized_dimension': 0}, 'sparsity_parameters': {}}
11:56:12:objectdetection_coral_adapter.py: Output details: {'name': 'TFLite_Detection_PostProcess', 'index': 6, 'shape': array([  1, 100,   4]), 'shape_signature': array([  1, 100,   4]), 'dtype': , 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}
11:56:12:objectdetection_coral_adapter.py: no TPU interpreters: Falling back to CPU detection
11:56:12:objectdetection_coral_adapter.py: no TPU interpreters: Falling back to CPU detection
11:56:12:objectdetection_coral_adapter.py: no TPU interpreters: Falling back to CPU detection
11:56:12:objectdetection_coral_adapter.py: no TPU interpreters: Falling back to CPU detection
11:56:12:objectdetection_coral_adapter.py: no TPU interpreters: Falling back to CPU detection
11:56:12:Client request 'detect' in queue 'objectdetection_queue' (...0bb031)
11:56:12:Module ObjectDetectionCoral has shutdown
11:56:12:objectdetection_coral_adapter.py: has exited
Any suggestions here on how to fix this but also how to perhaps get YoloV8 working with a better model ? even with the small model I'm still seeing weird detections that I never saw previously.

Thanks in advance!
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
126
Reaction score
88
Location
California
Looks like the file is named wrong. There is no file named:
yolov8m-int8_edgetpu.tflite

I think this is the correct fix:
 

mailseth

Getting the hang of it
Joined
Dec 22, 2023
Messages
126
Reaction score
88
Location
California
With that said, I might have made a mistake with the YOLOv8 image scaling. I fixed a bug this afternoon and am not sure when it will get rolled out. Try running YOLOv5 for now if you’re getting poor v8 results.
 

AlwaysSomething

Getting the hang of it
Joined
Apr 24, 2023
Messages
65
Reaction score
27
Location
US
I'm on an older version of CPAI and using an older model (I think previous to YOLOv5 it was just called Coral??) and it detects pretty accurate for me using a medium sized model. I actually just commented on it a couple of times. Here is that last thread:


Edit: I click the share on the post but it keeps sharing a previous post. My post was #2008

Been running CPAI (CPU or IGPU) since at late summer of last year and using the TPU since December. CPU/IGPU couldn't handle more than a couple of cameras if they triggered at the same time.

On a side note (sorry if hijacking) I was thinking of going the Proxmox route and starting a new thread to get some feedback from others who went that route. Just real quick, do you like and would you recommend it?

Thanks.
 

lanuya77

n3wb
Joined
Apr 10, 2024
Messages
1
Reaction score
0
Location
usa
I'm on an older version of CPAI and using an older model (I think previous to YOLOv5 it was just called Coral??) and it detects pretty accurate for me using a medium sized model. I actually just commented on it a couple of times. Here is that last thread:


Edit: I click the share on the post but it keeps sharing a previous post. My post was #2008

Been running CPAI (CPU or IGPU) since at late summer of last year and using the TPU since December. CPU/IGPU couldn't handle more than a couple of cameras if they triggered at the same time.

On a side note (sorry if hijacking) I was thinking of going the Proxmox route and starting a new thread to get some feedback from others who went that route. Just real quick, do you like and would you recommend it?

Thanks.
Ps:
Choosing the best game for you is soccer skills world cup.
It's understandable that CPU/IGPU wouldn't be ideal for handling multiple camera feeds simultaneously for CPAI. These resources are often shared with other system tasks and might not have the dedicated processing power for real-time video processing.
 

AlwaysSomething

Getting the hang of it
Joined
Apr 24, 2023
Messages
65
Reaction score
27
Location
US
^^ Exactly.

That is why I got the TPU which was just as accurate IMO when using the Medium sized model.
 
Top