Tensorflow on hassio

Is there any time estimate?

Dont know, last year had been 2months waiting for opencv fix.

Guess this will solve it. Unsure of what is needed to do to current setup once in release.

@hunterjm what will be the procedure for the ones of us that installed via your prevous addon to get this up and running again once 114 is released and we can upgrade? I am still running on 112 with the old addon so next update will be to 114.

TensorFlow 2 wheels are pre-built for Hassio now, so the only setup you need is in this repo. No more custom addon! This is working as of 0.114.0b2 (beta channel).

Thanks. Ask hassio is mainly based on containers, does that mean itā€™s also possible to use the container with an HA thatā€™s ā€œdockerizedā€?

Thanks. So I will uninstall the addon. Anything else that needs to be removed? I guess the tensorflow folder.

Running hassio via the install script ie docker. Anything to consider then? Or I just run the git command in the hassio config directory.

Thanks for your work. I really enjoy the tensorflow component together with my cameras.

Uninstall the addon, delete the deps and tensorflow folders in config, run the git command, and find a new model (I recommend one of the EfficientDet models).

1 Like

Thanks, running effecientdet d4. Takes 5 seconds. Maybe I will try the d2 instead. Hopefully there will be Coral support in the future !

Thanks for the great work.

I Didnā€™t have the addon, deleted deps and tensorflow folders, ran the git command, extracted new model (efficientdet_d3_coco17_tpu-32) but I am getting error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/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 155, in tensorflow_hass_start
    detection_model = model_builder.build(
  File "/config/tensorflow/object_detection/builders/model_builder.py", line 1015, in build
    return build_func(getattr(model_config, meta_architecture), is_training,
  File "/config/tensorflow/object_detection/builders/model_builder.py", line 372, in _build_ssd_model
    feature_extractor = _build_ssd_feature_extractor(
  File "/config/tensorflow/object_detection/builders/model_builder.py", line 350, in _build_ssd_feature_extractor
    return feature_extractor_class(**kwargs)
  File "/config/tensorflow/object_detection/models/ssd_efficientnet_bifpn_feature_extractor.py", line 554, in __init__
    super(SSDEfficientNetB3BiFPNKerasFeatureExtractor, self).__init__(
  File "/config/tensorflow/object_detection/models/ssd_efficientnet_bifpn_feature_extractor.py", line 161, in __init__
    efficientnet_base = efficientnet_model.EfficientNet.from_name(
  File "/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py", line 494, in from_name
    model = cls(config=config, overrides=overrides)
  File "/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py", line 452, in __init__
    output = efficientnet(image_input, self.config)
  File "/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py", line 364, in efficientnet
    x = conv2d_block(x,
  File "/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py", line 203, in conv2d_block
    x = tf.keras.layers.Activation(activation,
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 922, in __call__
    outputs = call_fn(cast_inputs, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/layers/core.py", line 420, in call
    return self.activation(inputs)
  File "/usr/local/lib/python3.8/site-packages/official/modeling/activations/swish.py", line 42, in simple_swish
    return features * tf.nn.sigmoid(features)
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/math_ops.py", line 3368, in sigmoid
    return gen_math_ops.sigmoid(x, name=name)
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_math_ops.py", line 8700, in sigmoid
    _, _, _op, _outputs = _op_def_library._apply_op_helper(
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/op_def_library.py", line 759, in _apply_op_helper
    return output_structure, op_def.is_stateful, op, outputs
  File "/usr/local/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 418, in inner_cm
    for fn in self._scope_exit_callbacks:
TypeError: 'NoneType' object is not iterable

Everything was working fine before the update of HA.

Any help???

btw, here is my config of image_processing that used to work:

  - platform: tensorflow
    scan_interval: 10000
    source:
      - entity_id: camera.front_door
    file_out:
      - "/share/tensorflow/{{ camera_entity.split('.')[1] }}_latest.jpg"
      - "/share/tensorflow/{{ camera_entity.split('.')[1] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg"
    model:
      graph: /config/tensorflow/models/efficientdet_d3_coco17_tpu-32/
      categories:
        - person

Thanks.

Try without categoies

Thanks but unfortunately it didnā€™t help, I am still getting the same error.

replace

      categories:
        - person

with

      categories:
        - category: person

Thanks, tried this as well, but I am still getting the error.

To clarify, do I still need to compile object detection library as described in the instructions?

BTW, Faster R-CNN Inception ResNet V2 640x640 this one doesnā€™t give any errors but HA crashes and restarts once the detection is triggered.

Iā€™ve followed instructions as per above (Tensorflow on hassio)
Then all I had to do was to update the graph modelā€¦ Obviously you need to be on 0.114 for it to work

Strange, I am on 0.114 and I followed the same instructions.

OK, all of a sudden detection has started to work today, well sort off. It is not as efficient as previous models I was using (TensorFlow 1.0 on 0.112). Maybe the output of ā€œimage_process scanā€ has changed as well in NodeRED. What I noticed when it works it only detects closer objects and not the ones further away. Somehow I donā€™t see any improvement over 1.0. Unfortunately I donā€™t have a backup of 0.112 any more.

Is there any way to go back to TS 1.0 on 0.114?

TensorFlow 2.0 is completely unusable at the moment. Sometimes (depending on the chosen model) it crashes Hassio and forces it to restart but most of the time detection rate is near zero. While previous version was working flawlessly albeit slow, this one gets one or two detections per day in the foreground and none in the background and I haver tried different models.

I donā€™t even know where I should report the bugs, on model zoo github or @hunterjm github page.

This is so frustrating mostly because it is not reported anywhere I think.

To go back to TF 1.x you will need to roll back to 0.112. The Hassio images were upgraded to python 3.8 in 0.113 and TF 1.x does not support python > 3.7.

Unfortunately I donā€™t have a backup any moreā€¦