Hi,
I want to use TFLite Model Maker to train custom object detection models. When I try to change the hparam image_size.
spec = EfficientDetModelSpec(
    model_name="efficientdet-lite0",
    uri="https://tfhub.dev/tensorflow/efficientdet/lite0/feature-vector/1",
    hparams={
        "image_size": "420x420"
    }
)
train_data, validation_data, test_data = object_detector.DataLoader.from_csv("...")
model = object_detector.create( train_data,
                                validation_data=validation_data,
                                model_spec=spec,
                                epochs=1,
                                batch_size=4,
                                train_whole_model=True)

The following error occurs:

  Error
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-4ed9b6a821a2> in <module>
----> 1 model = object_detector.create( train_data,
    2                                 validation_data=validation_data,
    3                                 model_spec=spec,
    4                                 epochs=1,
    5                                 batch_size=4,

c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow_examples\lite\model_maker\core\task\object_detector.py in create(cls, train_data, model_spec, validation_data, epochs, batch_size, train_whole_model, do_train)
  285     if do_train:
  286       tf.compat.v1.logging.info('Retraining the models...')
--> 287       object_detector.train(train_data, validation_data, epochs, batch_size)
  288     else:
  289       object_detector.create_model()

c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow_examples\lite\model_maker\core\task\object_detector.py in train(self, train_data, validation_data, epochs, batch_size)
  154       validation_ds, validation_steps, val_json_file = self._get_dataset_and_steps(
  155           validation_data, batch_size, is_training=False)
--> 156       return self.model_spec.train(self.model, train_ds, steps_per_epoch,
  157                                    validation_ds, validation_steps, epochs,
  158                                    batch_size, val_json_file)

c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow_examples\lite\model_maker\core\task\model_spec\object_detector_spec.py in train(self, model, train_dataset, steps_per_epoch, val_dataset, validation_steps, epochs, batch_size, val_json_file)
  262             val_json_file=val_json_file,
  263             batch_size=batch_size))
--> 264     train.setup_model(model, config)
  265     train.init_experimental(config)
  266     model.fit(

c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow_examples\lite\model_maker\third_party\efficientdet\keras\train.py in setup_model(model, config)
  111 def setup_model(model, config):
  112   """Build and compile model."""
--> 113   model.build((None, *config.image_size, 3))
  114   model.compile(
  115       steps_per_execution=config.steps_per_execution,

c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\keras\engine\training.py in build(self, input_shape)
  417                            'method accepts an `inputs` argument.')
  418         try:
--> 419           self.call(x, **kwargs)
  420         except (errors.InvalidArgumentError, TypeError):
  421           raise ValueError('You cannot build your model by calling `build` '

c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow_examples\lite\model_maker\third_party\efficientdet\keras\train_lib.py in call(self, inputs, training)
  883 
  884   def call(self, inputs, training):
--> 885     cls_outputs, box_outputs = self.base_model(inputs, training=training)
  886     for i in range(self.config.max_level - self.config.min_level + 1):
  887       cls_outputs[i] = self.classes(cls_outputs[i])

c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\keras\engine\base_layer.py in __call__(self, *args, **kwargs)
 1010         with autocast_variable.enable_auto_cast_variables(
 1011             self._compute_dtype_object):
-> 1012           outputs = call_fn(inputs, *args, **kwargs)
 1013 
 1014         if self._activity_regularizer:

c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\autograph\impl\api.py in wrapper(*args, **kwargs)
  668       except Exception as e:  # pylint:disable=broad-except
  669         if hasattr(e, 'ag_error_metadata'):
--> 670           raise e.ag_error_metadata.to_exception(e)
  671         else:
  672           raise

ValueError: in user code:

  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow_hub\keras_layer.py:243 call  *
      result = smart_cond.smart_cond(training,
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\saved_model\load.py:668 _call_attribute  **
      return instance.__call__(*args, **kwargs)
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\eager\def_function.py:828 __call__
      result = self._call(*args, **kwds)
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\eager\def_function.py:871 _call
      self._initialize(args, kwds, add_initializers_to=initializers)
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\eager\def_function.py:725 _initialize
      self._stateful_fn._get_concrete_function_internal_garbage_collected(  # pylint: disable=protected-access
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\eager\function.py:2969 _get_concrete_function_internal_garbage_collected
      graph_function, _ = self._maybe_define_function(args, kwargs)
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\eager\function.py:3361 _maybe_define_function
      graph_function = self._create_graph_function(args, kwargs)
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\eager\function.py:3196 _create_graph_function
      func_graph_module.func_graph_from_py_func(
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\framework\func_graph.py:990 func_graph_from_py_func
      func_outputs = python_func(*func_args, **func_kwargs)
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\eager\def_function.py:634 wrapped_fn
      out = weak_wrapped_fn().__wrapped__(*args, **kwds)
  c:\users\felix\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\saved_model\function_deserialization.py:267 restored_function_body
      raise ValueError(

  ValueError: Could not find matching function to call loaded from the SavedModel. Got:
    Positional arguments (2 total):
      * Tensor("inputs:0", shape=(None, 420, 420, 3), dtype=float32)
      * False
    Keyword arguments: {}
  
  Expected these arguments to match one of the following 4 option(s):
  
  Option 1:
    Positional arguments (2 total):
      * TensorSpec(shape=(None, 320, 320, 3), dtype=tf.float32, name='inputs')
      * True
    Keyword arguments: {}
  
  Option 2:
    Positional arguments (2 total):
      * TensorSpec(shape=(None, 320, 320, 3), dtype=tf.float32, name='input_1')
      * False
    Keyword arguments: {}
  
  Option 3:
    Positional arguments (2 total):
      * TensorSpec(shape=(None, 320, 320, 3), dtype=tf.float32, name='input_1')
      * True
    Keyword arguments: {}
  
  Option 4:
    Positional arguments (2 total):
      * TensorSpec(shape=(None, 320, 320, 3), dtype=tf.float32, name='inputs')
      * False
    Keyword arguments: {}


Does this mean, that custom input shape is not supported?