0

my code:

    inputEle = [ak.ImageInput(name='n1'),ak.ImageInput(name='n2'),
           ak.ImageInput(name='n3'),ak.ImageInput(name='n4')]
        outputEle = [ak.ClassificationHead(name='n7')]
    am = ak.AutoModel(
        inputs=inputEle,
        outputs=outputEle,
        objective='val_accuracy',
        overwrite=True
    )
    history = am.fit(x=self.inputs, y=self.outputs, validation_split=0.2, verbose=1)`

error is:

/usr/local/lib/python3.11/dist-packages/autokeras/auto_model.py in fit(self, x, y, batch_size, epochs, callbacks, validation_split, validation_data, verbose, **kwargs)
    301             )
    302 
--> 303         history = self.tuner.search(
    304             x=dataset,
    305             epochs=epochs,

/usr/local/lib/python3.11/dist-packages/autokeras/engine/tuner.py in search(self, epochs, callbacks, validation_split, verbose, **fit_kwargs)
    198         hp = self.oracle.get_space()
    199         self._prepare_model_build(hp, **fit_kwargs)
--> 200         self._try_build(hp)
    201         self.oracle.update_space(hp)
    202         super().search(

/usr/local/lib/python3.11/dist-packages/keras_tuner/src/engine/tuner.py in _try_build(self, hp)
    162         gc.collect()
    163 
--> 164         model = self._build_hypermodel(hp)
    165         # Stop if `build()` does not return a valid model.
    166         if not isinstance(model, keras.models.Model):

/usr/local/lib/python3.11/dist-packages/keras_tuner/src/engine/tuner.py in _build_hypermodel(self, hp)
    153     def _build_hypermodel(self, hp):
    154         with maybe_distribute(self.distribution_strategy):
--> 155             model = self.hypermodel.build(hp)
    156             self._override_compile_args(model)
    157             return model

/usr/local/lib/python3.11/dist-packages/keras_tuner/src/engine/hypermodel.py in _build_wrapper(self, hp, *args, **kwargs)
    118             # to the search space.
    119             hp = hp.copy()
--> 120         return self._build(hp, *args, **kwargs)
    121 
    122     def declare_hyperparameters(self, hp):

/usr/local/lib/python3.11/dist-packages/autokeras/graph.py in build(self, hp)
    231             for output_node, real_output_node in zip(block.outputs, outputs):
    232                 keras_nodes[self._node_to_id[output_node]] = real_output_node
--> 233         model = keras.Model(
    234             keras_input_nodes,
    235             [

/usr/local/lib/python3.11/dist-packages/keras/src/utils/tracking.py in wrapper(*args, **kwargs)
     24     def wrapper(*args, **kwargs):
     25         with DotNotTrackScope():
---> 26             return fn(*args, **kwargs)
     27 
     28     return wrapper

/usr/local/lib/python3.11/dist-packages/keras/src/models/functional.py in __init__(self, inputs, outputs, name, **kwargs)
    133             inputs, outputs = clone_graph_nodes(inputs, outputs)
    134 
--> 135         Function.__init__(self, inputs, outputs, name=name, **kwargs)
    136 
    137         if trainable is not None:

/usr/local/lib/python3.11/dist-packages/keras/src/ops/function.py in __init__(self, inputs, outputs, name)
     75             self._self_setattr_tracking = _self_setattr_tracking
     76 
---> 77         (nodes, nodes_by_depth, operations, operations_by_depth) = map_graph(
     78             self._inputs, self._outputs
     79         )

/usr/local/lib/python3.11/dist-packages/keras/src/ops/function.py in map_graph(inputs, outputs)
    329     for name in all_names:
    330         if all_names.count(name) != 1:
--> 331             raise ValueError(
    332                 f'The name "{name}" is used {all_names.count(name)} '
    333                 "times in the model. All operation names should be unique."

ValueError: The name "resnet50" is used 4 times in the model. All operation names should be unique.

it looks like i use same layer,but i use different name to each Input.

Is it that auto-keras doesn't support using multiple ImageInput, or is there something wrong with my usage?

The official documentation doesn't provide an explanation. Wanted to know if it is good practice to do that and what would be the best way to do that?

New contributor
user30348744 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.