Tensorflow on hassio

No errors in log file and no errors when i install the addon, this happens to more people.

If I do not install the addon but if I put the component, it starts. If I install the addon, I have to comment on the graph line so that it starts up and gives error when not finding the file. The route is correct so I don’t know what it can be.

I’m receiving the same results as you guys. HA simply doesn’t boot if the image_processing portion in my config. My YAML looks identical to yours. If you find a fix, please let me know!

Having the same issue. When looking at the console during home assistants boot up I’m seeing this error:

hass io > ha restart
2742.277130] udeudt8): starting version 3.2.8
2742.2880321 udeudl9]: starting cudeu-3.2 .8
2751.5162601 traps: Python31599781 trap invalid opcode ip:7f65615b9c00 sp:7f657a6a6408 error:e in _prap_tensorflow_internal
sol7f656e581000 +1312000
2751.5239191 audit: type 1701 aud it ( 15666 18670.282:529): auld-1291967295 uid-e gid-e ses-1291967295 subj==unconfined pid-58121
CORR="python3" exe-"/usr/local/bin python3.7" sig-4 res-1
Error: Unknoun Error, see logs

I’m running hassos on a vm if that matters

Hi all, forgive my noobness but I have installed tensorflow, im using hass.io docker in Ubuntu server on a nuc. I have tried to boot it up and i get this in my .log file

2019-08-30 17:31:32 ERROR (MainThread) [homeassistant.components.image_processing] Error while setting up platform tensorflow
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/tensorflow/image_processing.py", line 114, in setup_platform
    detection_graph = tf.Graph()
AttributeError: module 'tensorflow' has no attribute 'Graph'

Hi,
I have HASSIO runing on intel NUC I3.
Intalled TF from repo using the addon, extraced files and placed in /config follwoing instrucitons.
I am having the same issue where HA would not startup at all when imageprocessing is placed in yaml file.

Anyone had progress with this?

Try without the addon (remove the files from deps folder), worked for me with hassio out of the box.

Thanks you for your feedback.
I have deleted the dep folder and removed the addon (using uninstall button).
So now HASSIO boot but i am getting the following error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/tensorflow/image_processing.py", line 303, in process_image
    import cv2  # pylint: disable=import-error
ModuleNotFoundError: No module named 'cv2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 136, in async_update
    await self.async_process_image(image.content)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/tensorflow/image_processing.py", line 312, in process_image
    img = Image.open(io.BytesIO(bytearray(image))).convert("RGB")
  File "/usr/local/lib/python3.7/site-packages/PIL/Image.py", line 2822, in open
    raise IOError("cannot identify image file %r" % (filename if filename else fp))
OSError: cannot identify image file <_io.BytesIO object at 0x7f7fb6675350>

my configuration.yaml looks like this:

  - platform: tensorflow
    source:
       - entity_id: camera.living_room_camera
    model:
       graph: /config/tensorflow/model/frozen_inference_graph.pb
       categories:
        - category: person

Any idea?

Thanks,

Trying to use the local.file component to feed a picture to Tensorflow does work:

  - platform: local_file
    file_path: /config/www/test.jpg
    name: living room camera

So it look like TF is working but but not with the camera stream.
I am using a generic ip camera compent to stream rtsp feed from my wyze cam.
Does anyone has issues with this camera coponent?
My camera configuration looks like this:

  - platform: generic
    name: Living room camera
    still_image_url: https://still_image_url_from_motion_eye
    stream_source: rtsp://username:[email protected]/live

Are there any options for this coponent to optimize it for Tensorflow or shell i use a different component?

I’m having the same problem, TF doesn’t appear to like using my camera as a source.
The logs show;

Update for image_processing.tensorflow_driveway_camera fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/tensorflow/image_processing.py", line 303, in process_image
    import cv2  # pylint: disable=import-error
ModuleNotFoundError: No module named 'cv2'

This is using the HA docker image, with nothing additional done to it (short of placing the required files in /config/tensorflow).
Is anyone able to confirm that OpenCV should be working in the Hassio docker image (0.99.2)?

Hi swifty,

You do not need to install cv2, the addon can handle without it.
This indicates TF does not pick the snapshot from the camera.
When i had this issue first i checked if the integration works simply by feeding jpg image to camera.local integration and observing if it’s anlyzed properly. If it does then your camera configuraiton is not correct probably.

Thanks - I haven’t had chance to check again yet, but I suspect like you mine will probably work OK with the local file.

Did you manage to get yours working with a generic camera entity? - I have tried specifying a few of my cameras (all added via the generic camera component) and none work, they all fail with the ‘update for image fails’ error in my last post - yet the camera itself shows fine within HomeAssistant…

-Edit, I’ve now had chance to test it with a ‘local file’ camera and as suspected it works flawlessly…
So, what’s the magic to get this going with the ‘generic camera’ component ?

Use the mjpeg camera without the snapshot url to stream from motioneye addon:

camera:

  - platform: mjpeg
    name: Living room camera
    mjpeg_url: <http://YOUR HASSIO LOCAL IP>:<STREAMING PORT FOR THIS CAMERA>
    username: <MOTIONEYE USER (not admin)>
    password:< MOTIONEYE USER PASSWORD>

The stream shell be configured in motioneye (not directly from the camera).
This is how it worked for me.
Hope this helps.

Thanks for the tips Lior.

I did some digging tonight and managed to get it working with the generic camera component.
Turns out the issue was down to my camera having a security setting set to ‘digest’ login only - when I change this to ‘digest & basic’ the image processing component can pull the images OK.

Good news.
Your welcome.

Did anyone find a solution to this?

I’ve just setup the jhunter addon on hass.io running on a nuc
My model is in the correct location but i get these error not matter what i do

I had to actually install tensorflow. I had the same error when trying the docker container

Thanks for the response, i’ve seen your instructions above. will they work on hass.io?

I have no idea though I doubt it as hass.io is a bit restricted with what you can do outside of ha…

Does this need to be fixed with the tensorflow installer addon @hunterjm created or is it to be fixed somewhere else?

The addon is removed, you must wait for fix. Tensorflow and OpenCV do not work on .113. You can try DOODS, but it is not that good