autokeras
autokeras copied to clipboard
Layer names duplicated with multiple image inputs
Bug Description
When multiple ImageBlocks are used in the same model, the layer names they generate are not unique, so the model does not build.
Bug Reproduction
input_node1 = ak.ImageInput()
input_node2 = ak.ImageInput()
output_node1 = ak.ImageBlock(augment=False)(input_node1)
output_node2 = ak.ImageBlock(augment=False)(input_node2)
merged = ak.Merge()([output_node1, output_node2])
output_node = ak.ClassificationHead()(merged)
clf = ak.AutoModel(
inputs=[input_node1, input_node2],
outputs=output_node,
overwrite=True,
max_trials=5)
Expected Behavior
The model should build. Instead:
ValueError: The name "conv1_pad" is used 2 times in the model. All layer names should be unique.
Setup Details
Include the details about the versions of:
- OS type and version: Colab
- Python: 3.6
- autokeras: 1.0.3
- keras-tuner: 1.0.2rc0
- scikit-learn: 0.22.2.post1
- numpy: 1.18.5
- pandas: 1.0.5
- tensorflow: 2.2.0
Is there any update on this issue ? I'm facing the same problem as well
Also interested in this issue - and is it applicable to other block types as well?
Renaming the layers in the following way solved the problem for me.
for layer in model_con_1.layers : layer._name = layer.name + str('_1') for layer in model_con_2.layers : layer._name = layer.name + str('_2')
Any update? I'm facing this problem trying to create an AutoModel with multiple ImageInputs
Bump on this one. Is it possible to use multiple image inputs with AutoModel? I see that rakshith291 posted some code to rename layers, but where does that go, somewhere in the source of the fit function?
same issue, I have tried to change autokeras _convert_to_dataset function but not work