Tensorflow on hassio

Tried installing with the script from TensorFlow - Home Assistant

However I get this error message. What am I doing wrong?

inflating: protobuf/include/google/protobuf/source_context.proto [text]
creating: protobuf/bin/
inflating: protobuf/bin/protoc [binary]
inflating: protobuf/readme.txt [text]
mv: cannot move ‘protobuf/bin’ to ‘/tmp/tensorflow-models/research’: No such file or directory
./tensorflow_setup.sh: 15: cd: can’t cd to /tmp/tensorflow-models/research/
./tensorflow_setup.sh: 16: ./tensorflow_setup.sh: ./bin/protoc: not found
mv: cannot stat ‘object_detection/data’: No such file or directory
mv: cannot stat ‘object_detection/utils’: No such file or directory
mv: cannot stat ‘object_detection/protos’: No such file or directory

This how i get it to work:

  1. Install and run the tensorflow addon.

  2. Download and extract this: https://github.com/robmarkcole/tensorflow_files_for_home_assistant_component

  3. Put the tensorflow folder on /config dir.

  4. Download and extract this: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v2_coco_2018_03_29.tar.gz

  5. Rename the folder “ssd_mobilenet_v2_coco_2018_03_29” to “model”. (optional)

  6. Put the ‘model’ folder into /config/tensorflow dir.

  7. Add this to configuration.yaml:

     image_processing:
       - platform: tensorflow
         source:
           - entity_id: camera.back_door
           - entity_id: camera.front_door
         model:
           graph: /config/tensorflow/model/frozen_inference_graph.pb
          categories:
            - category: person
    
  8. Reload HA.

Hope this help!

6 Likes

Setup according to your guide. When I do I manuakl scan of a picture which has a person and some cars in it I get nothing. Also I see no bump in cpu usage. The the tensorflow entities says state 0 and I have set file output but no files are generated. I do think that the person and cars ought to be detected.

How do I debug? I get no error messages what so ever.

Do I need to set anything in the config area of the hassio tensorflow addon?

In the instructions i am using a live camera entity so the picture is taken when you run the scan. If you have the picture already you have to setup the local file camera entity and scan with that entity.

Yes, I have tried with local file as well. I dont get any error messages and no result but 0. How does one turn on debug for tensorflow?

Redid everything and now it seems to work! Is there some easy way of figuring out how to set the area one wants? Some editor or something to get the correct values?

Hi!
Does it work with hassio ? Or only with home assistant install ?

Yes it works on hassio. You can install the addon from this repo:

Ok :slight_smile: , but not on raspberry yet !

Thanks a million

The Tensorflow add-on does not start on reboot despite having that option selected. Is this happening for anyone else?

It’s only supposed to run a single time to install the required packages. Don’t start that on boot.

Check the component page - it states you have to use the “area” within the model section.
Example from above with area added:

image_processing: 
  - platform: tensorflow 
    source:
      - entity_id: camera.back_door 
      - entity_id: camera.front_door 
    model: 
      graph: /config/tensorflow/model/frozen_inference_graph.pb 
    categories: 
      - category: person
        area:
          # Exclude top 10% of image
          top: 0.1
          # Exclude right 15% of image
          right: 0.85
1 Like

I’m getting this error message I’m guessing it has to do with me running HASSIO in VM on VirtualBox and not passing playing nice with GPUs

tensorflow/core/platform/cpu_feature_guard.cc:37] The TensorFlow library was compiled to use FMA instructions, but these aren’t available on your machine.

Any thoughts on if I could run Tensorflow on another machine, but get the same integration with Home Assistant as if it was running on the same machine?

My initial thought would be probably not.
At that point you’d probably do something where Tensorflow is stand alone - and you send MQTT messages or something similar to Home Assistant.

There are a few projects on here that are doing this - search the shared projects if you haven’t already to learn more.

@DeadEnd - do you think it’s possible to run Tensorflow on a VM in Virtualbox

Yes, I think there are instructions on Tensorflow website on running it in different environments. I think doing a VM would follow the standard installation process .

This is the issue I am now running into, any thoughts?

2019-05-03 14:47:52.712687: F tensorflow/core/platform/cpu_feature_guard.cc:37] The TensorFlow library was compiled to use FMA instructions, but these aren’t available on your machine.

Did you build tensorflow on the computer you are trying to run it, or did you pull a pre-built form somewhere?

From my Google-fu it sounds like that happens when the build doesn’t match the hardware.