Translate_tf_model » UnsupportedModelError: Unexpected node Sigmoid1?

Hi Hailo experts, I am compiling another model in TFlite format and got the following error message:
UnsupportedModelError: Unexpected node Sigmoid1 (DEQUANTIZE)
Your help is very much appreciated, Klaus

[info] Translation started on Tensorflow model dense_example

UnsupportedModelError Traceback (most recent call last)
Cell In[19], line 9
6 model_path = “…/models/FD_EffDet-Lite1-384x384x3-2024-10-15.tflite”
8 runner = ClientRunner(hw_arch=chosen_hw_arch)
----> 9 hn, npz = runner.translate_tf_model(model_path, model_name)

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_sdk_common/states/states.py:16, in allowed_states..wrap..wrapped_func(self, *args, **kwargs)
12 if self._state not in states:
13 raise InvalidStateException(
14 f"The execution of {func.name} is not available under the state: {self._state.value}",
15 )
—> 16 return func(self, *args, **kwargs)

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py:1222, in ClientRunner.translate_tf_model(self, model_path, net_name, start_node_names, end_node_names, tensor_shapes)
1182 “”"
1183 DFC API for parsing a TF model given by a checkpoint/pb/savedmodel/tflite file. This creates
1184 a runner with loaded HN (model) and parameters.
(…)
1219
1220 “”"
1221 parser = Parser()
→ 1222 parser.translate_tf_model(
1223 model_path=model_path,
1224 net_name=net_name,
1225 start_node_names=start_node_names,
1226 end_node_names=end_node_names,
1227 tensor_shapes=tensor_shapes,
1228 )
1229 return self._finalize_parsing(parser.return_data)

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_model_optimization/tools/subprocess_wrapper.py:124, in subprocess_wrapper..decorator..parent_wrapper(self, *args, **kwargs)
122 self.dist_info = dist_info
123 self.build_model()
→ 124 func(self, *args, **kwargs)
126 # This flag should be present in Develop
127 if force_rebuild:

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py:101, in Parser.translate_tf_model(self, model_path, net_name, start_node_names, end_node_names, tensor_shapes)
98 suggest_other_node_names(name, node_names, “End”)
100 self._return_data[“original_model_meta”][“original_model_path”] = os.path.abspath(model_path)
→ 101 parsing_results = self.parse_model_to_hn(
102 graph,
103 values,
104 valid_net_name,
105 start_node_names,
106 end_node_names,
107 nn_framework,
108 )
109 milestone = self._format_time_milestone(start_time)
110 self._logger.info(
111 f"Translation completed on Tensorflow model {valid_net_name} (completion time: {milestone})",
112 )

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py:367, in Parser.parse_model_to_hn(self, model, values, net_name, start_node_names, end_node_names, nn_framework, output_shapes, net_input_format, rename_layers_by_blocks)
364 else:
365 raise BackendRuntimeException(f"Unsupported NN framework {nn_framework}")
→ 367 fuser = HailoNNFuser(converter.convert_model(), net_name, converter.end_node_names)
368 hailo_nn = fuser.convert_model()
369 hailo_nn.validate_stage(HnStage.HN)

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_sdk_client/model_translator/translator.py:83, in HailoNNConverter.convert_model(self)
81 self._validate_model_params()
82 self._validate_bn_ops_in_training()
—> 83 self._create_layers()
84 self._add_layers_connections()
85 self._layers_graph.set_names_and_indices()

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py:40, in EdgeNNConverter._create_layers(self)
38 self._add_input_layers()
39 self._update_vertices_info()
—> 40 self._add_direct_layers()
41 self._validate_processed_vertices()

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_sdk_client/model_translator/edge_nn_translator.py:122, in EdgeNNConverter._add_direct_layers(self)
120 elif vertex not in self._visited_states:
121 self._logger.debug(f"Processing vertex {vertex.name}")
→ 122 self._layer_callback_from_vertex(vertex)
123 self._visited_states[vertex] = VertexState.PROCESSED
125 for node in sorted(self._graph.successors(vertex), key=attrgetter(“name”)):

File ~/.pyenv/versions/3.10.15/lib/python3.10/site-packages/hailo_sdk_client/model_translator/tflite_translator/tflite_translator.py:267, in TFLiteConverter._layer_callback_from_vertex(self, vertex)
265 layer, consumed_vertices, activation = create_layer_from_vertex(LayerType.tile, vertex)
266 else:
→ 267 raise UnsupportedModelError(f"Unexpected node {vertex.name} ({vertex.op})")
269 except (RecordableParserError, RecordableCreateLayerError) as e:
270 self._handle_recordable_parser_error(vertex, e)

UnsupportedModelError: Unexpected node Sigmoid1 (DEQUANTIZE)

This tflite model may have been trained with QAT (quantized aware training) enabled and Hailo tools don’t support models trained in this manner. Is it possible to get the original model trained in float ?

1 Like

Hi VictorC, we started using Quantization Aware Training in Tensorflow, since TF QAT gave us the best results. Need to retrain our models w/o QAT. Either using Keras object detection or Hailo Model Zoo w/ Hailo Docker. Your recommendation? Thanks for your help. Klaus

Hi Klaus, you can use either way to train your model. We provide retraining docker for the yolov8 models in our Hailo Model Zoo. Please feel free to use them. Just be aware of licensing terms from Ultralytics.

1 Like