Skip to content

Fix empty ['' ] detection error messages#20

Open
v-mwalk wants to merge 1 commit into
codeproject:mainfrom
v-mwalk:Fix-empty-detection-error-messages
Open

Fix empty ['' ] detection error messages#20
v-mwalk wants to merge 1 commit into
codeproject:mainfrom
v-mwalk:Fix-empty-detection-error-messages

Conversation

@v-mwalk

@v-mwalk v-mwalk commented Jul 11, 2026

Copy link
Copy Markdown

Blue Iris was receiving detection responses with an empty message, which broke its parsing. Three issues were causing this;

  • objectdetection_coral_adapter.py hardcoded "message": '' on every failed detection instead of using the captured error string, so the real failure reason never reached Blue Iris.

  • Fixing that exposed the real underlying exception: "There is at least 1 reference to internal data in the interpreter in the form of a numpy array or slice." In objectdetection_coral_singletpu.py, periodic_check() (which can tear down and rebuild the shared interpreter on its hourly refresh) ran outside inference_lock, while interpreter.invoke() and detect.get_objects() ran inside it. A concurrent interpreter refresh could reallocate the interpreter's tensor buffers while another in-flight request still held live numpy views into the old interpreter's output, triggering this TFLite safety check. Fixed by moving the whole critical section (periodic_check, input setup, invoke, and output extraction) inside a single inference_lock block so a refresh can never overlap an in-flight detection.

  • modulesettings.json had Parallelism set to 16 for a single physical Coral USB Accelerator. The file's own comment says this should be TPU count * 2, so corrected to 2. Sixteen concurrent workers queuing against one serialized device was contributing to the intermittent failures in the first place.

Verified on the Pi: restarted the service, watched live traffic from Blue Iris and client meshed, saw clean results with no empty messages and no TFLite errors.

FYI @ChrisMaunder

Adapter hardcoded an empty error message on failed detections, masking the real exception. Fixing that exposed a TFLite race: periodic_check() could rebuild the shared interpreter outside inference_lock while another thread was mid-invoke on it. Moved the whole critical section inside the lock. Also corrected Parallelism from 16 to 2 for the single-TPU config, per the file's own "TPU count * 2" comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant