Skip to content

Commit

Permalink
[FIX](handler) input tensor shape
Browse files Browse the repository at this point in the history
  • Loading branch information
wbenbihi committed Aug 23, 2022
1 parent 83b2705 commit 046c809
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions hourglass_tensorflow/handlers/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,7 @@ def _build_input(self, *args, **kwargs) -> tf.Tensor:
# TODO: Handle other Image Mode than RGB
channels = 3
if self.config.data_format == "NHWC":
self._input = InputTensor(shape=(None, height, width, channels))
else:
raise BadConfigurationError("The only supported data format is NHWC so far")
return self._input

def _build_output(self, *args, **kwargs) -> tf.Tensor:
height, width = self.params.input_size, self.params.input_size
# TODO: Handle other Image Mode than RGB
channels = 3
if self.config.data_format == "NHWC":
self._input = InputTensor(shape=(None, height, width, channels))
self._input = InputTensor(shape=(height, width, channels), name="Input")
else:
raise BadConfigurationError("The only supported data format is NHWC so far")
return self._input
Expand All @@ -116,8 +106,8 @@ def _build_model_as_model(self, *args, **kwargs) -> HourglassModel:

def _build_model_as_layer(self, *args, **kwargs) -> keras.models.Model:
self._layered_model = model_as_layers(inputs=self._input, **self.params.dict())
self._output = self._layered_model.outputs
self._model = self._layered_model.model
self._output = self._layered_model["outputs"]
self._model = self._layered_model["model"]
return self._model

def generate_graph(self, *args, **kwargs) -> None:
Expand All @@ -129,7 +119,7 @@ def generate_graph(self, *args, **kwargs) -> None:
# Link Input Shape to Model
self._output = model(inputs=input_tensor, *args, **kwargs)
else:
model = self._build_model_as_model(*args, **kwargs)
model = self._build_model_as_layer(*args, **kwargs)


# endregion

0 comments on commit 046c809

Please sign in to comment.