Exception thrown after camera_client.captureimage() in Vision AI Developer Kit

Copper Contributor

While attempting the face detect sample, we find the vision sample container throws an exception after trying to run captureimage(). We've logged an issue on github including code details and stack trace and hope to get more traction here.

send: b'\x89\x80\xa3]I,'
2019-10-14 01:40:44,863 - iotccsdk - ERROR - camera - captureimage:602 - true
[PKS INFO] Loading snapshot from file...
Expected 1 file but got 0
2019-10-14 01:40:45,042 - iotccsdk - ERROR - camera - get_inferences:197 - invalid file: None
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/iotccsdk/camera.py", line 195, in get_inferences
    yield inference_iterator.start(self.vam_url)
  File "./main.py", line 134, in main
    azure_face_api_detect(camera_client, iot_hub_manager)
  File "/app/azure_face_api.py", line 66, in azure_face_api_detect
    image_data = open(get_snapshot_name(), "rb")
TypeError: invalid file: None
Exception from get inferences:
['Traceback (most recent call last):\n', '  File "./main.py", line 134, in main\n    azure_face_api_detect(camera_client, iot_hub_manager)\n', '  File "/app/azure_face_api.py", line 66, in azure_face_api_detect\n    image_data = open(get_snapshot_name(), "rb")\n', 'TypeError: invalid file: None\n']
2019-10-14 01:40:47,673 - iotccsdk - ERROR - ipcprovider - on_error:341 - Camera Restarted! Exiting!!
Error: Time:Mon Oct 14 01:40:48 2019 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_dowork Line:1006 Socketio_Failure: Receiving data from endpoint: errno=104.
Error: Time:Mon Oct 14 01:40:48 2019 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_dowork Line:1006 Socketio_Failure: Receiving data from endpoint: errno=104.

our dockerfile uses requirements.txt to install these libraries:

requests
azure-iothub-device-client~=1.4.3
iotccsdk
azure

Any help would be appreciated, thank you.

2 Replies

@sezflynn Thank you for highlighting this. I'm investigating and will get back soon.

@sezflynn 

Unfortunately, there is a known issue with the camera client api below the iotccsdk, where during a session a snapshot should be taken right after the camera is started to ensure stability of the snapshot function.

If an inference is detected before a test snapshot is taken first the snapshot fails and can crash the module. A quick way to work around the issue is to make sure the frame is clear of objects that will trigger inference during module startup. Say, for example, simply covering the camera lens for a few seconds while the module starts up.

I've also posted this reply on the  GitHub issue which you had opened.