Tensorflow on hassio

So… if I want to report a bug related to TensorFlow, where would be the best place? I am confused because it relies on so many components. Would this be hassio, python or solely TF related issue or maybe it’s the new models? So many GitHub pages…

So, my disk broke down and had to reinstall. Did a resotre of a backup.

Tensorflow not working. Which it did before reinstall with backup.

Getting this error.

Logger: homeassistant

Source: tensorflow/object_detection/models/ssd_efficientnet_bifpn_feature_extractor.py:161
First occurred: 0:37:28 (2 occurrences)
Last logged: 0:37:31

Error doing job: Future exception was never retrieved
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 467, in init
super(SSDEfficientNetB2BiFPNKerasFeatureExtractor, 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 388, in efficientnet
x = mb_conv_block(x, block, config, block_prefix)
File “/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py”, line 247, in mb_conv_block
x = conv2d_block(x,
File “/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py”, line 197, in conv2d_block
x = batch_norm(axis=bn_axis,
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/normalization.py”, line 741, in call
outputs = self._fused_batch_norm(inputs, training=training)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/layers/normalization.py”, line 632, in _fused_batch_norm
self.add_update(mean_update)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/util/deprecation.py”, line 507, in new_func
return func(*args, **kwargs)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py”, line 1459, in add_update
updates = [process_update(x) for x in updates]
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py”, line 1459, in
updates = [process_update(x) for x in updates]
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py”, line 1455, in process_update
reachable = tf_utils.get_reachable_from_inputs(relevant_inputs, [update])
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/utils/tf_utils.py”, line 138, in get_reachable_from_inputs
outputs = x.consumers()
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py”, line 674, in consumers
return [
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py”, line 675, in
self.graph._get_operation_by_name_unsafe(name)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py”, line 3663, in _get_operation_by_name_unsafe
return self._nodes_by_name[name]
KeyError: ‘stack_2/block_0/depthwise_activation/Sigmoid’

I will downgrade to a snapshot with old tensorflow. Remove and then update to 114 and then get the new tensorflow.

Downgraded to a snapshot 112.4 and old tensorflow works great. Removed deps and tensorflow folders.
upgraded to 114.2. Did the git command and updated config.

Getting this error at startup.

Logger: homeassistant
Source: tensorflow/object_detection/models/ssd_efficientnet_bifpn_feature_extractor.py:161
First occurred: 11:22:58 (2 occurrences)
Last logged: 11:23:01

Error doing job: Future exception was never retrieved
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 467, in init
super(SSDEfficientNetB2BiFPNKerasFeatureExtractor, 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 388, in efficientnet
x = mb_conv_block(x, block, config, block_prefix)
File “/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py”, line 256, in mb_conv_block
x = conv2d_block(x,
File “/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py”, line 197, in conv2d_block
x = batch_norm(axis=bn_axis,
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/normalization.py”, line 741, in call
outputs = self._fused_batch_norm(inputs, training=training)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/layers/normalization.py”, line 632, in _fused_batch_norm
self.add_update(mean_update)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/util/deprecation.py”, line 507, in new_func
return func(*args, **kwargs)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py”, line 1459, in add_update
updates = [process_update(x) for x in updates]
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py”, line 1459, in
updates = [process_update(x) for x in updates]
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py”, line 1455, in process_update
reachable = tf_utils.get_reachable_from_inputs(relevant_inputs, [update])
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/keras/utils/tf_utils.py”, line 138, in get_reachable_from_inputs
outputs = x.consumers()
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py”, line 674, in consumers
return [
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py”, line 675, in
self.graph._get_operation_by_name_unsafe(name)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py”, line 3663, in _get_operation_by_name_unsafe
return self._nodes_by_name[name]
KeyError: ‘stack_1/block_0/depthwise_activation/mul’

And now it works. Regardless of error message.

do you get the same level of detection as the V1 TF model?
I definitely get less results with V2…

I havent tried that much yet! But had different model with V1.

So, which models are you guys using? I am trying out efficientdet d2 at the moment.

I tried d2, d5 and d7…

I have some issues generally with it working but when it does it is really a big change compared to V1. V1 was superb running the mobilenet coco model. V2 I have tried different models and it is not to be trusted. V1 was 100%.

Mine has stopped working altogether, nothing works anymore and last detection was more than 3 days ago. This is clearly broken.

Maybe possible to run the old solution in some way. On a standalone pi4 or something.

The error is back again:

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 388, in efficientnet
x = mb_conv_block(x, block, config, block_prefix)
File “/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py”, line 288, in mb_conv_block
se = conv2d_block(se,
File “/usr/local/lib/python3.8/site-packages/official/vision/image_classification/efficientnet/efficientnet_model.py”, line 193, in conv2d_block
x = conv2d(**init_kwargs)(inputs)
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/convolutional.py”, line 218, in call
outputs = nn.bias_add(outputs, self.bias, data_format=‘NHWC’)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/nn_ops.py”, line 2778, in bias_add
bias = ops.convert_to_tensor(bias, dtype=value.dtype, name=“bias”)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/framework/ops.py”, line 1341, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py”, line 1825, in _dense_var_to_tensor
return var._dense_var_to_tensor(dtype=dtype, name=name, as_ref=as_ref) # pylint: disable=protected-access
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py”, line 1242, in _dense_var_to_tensor
return self.value()
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py”, line 550, in value
return self._read_variable_op()
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py”, line 645, in _read_variable_op
result = read_and_set_handle()
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py”, line 635, in read_and_set_handle
result = gen_resource_variable_ops.read_variable_op(self._handle,
File “/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_resource_variable_ops.py”, line 482, in read_variable_op
_, _, _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