JanMarcelKezmann / TensorFlow-Advanced-Segmentation-Models

A Python Library for High-Level Semantic Segmentation Models based on TensorFlow and Keras with pretrained backbones.
Other
151 stars 48 forks source link

bug in unet.py? #6

Closed panker98 closed 3 years ago

panker98 commented 3 years ago

there should be something wrong with unet.py ?{ValueError: The channel dimension of the inputs should be defined. Found None.}

JanMarcelKezmann commented 3 years ago

Thank you for mentioning this. Could you please show the code you have executed, so I can reproduce and fix the error.

panker98 commented 3 years ago

@JanMarcelKezmann tasm.UNet(n_classes=NUM_CLASSES, base_model=base_model, output_layers=layers, backbone_trainable=False,final_activation="softmax",include_top_conv=True,height=KERNEL_SIZE,width=KERNEL_SIZE,depth=len(BANDS)).model() {include_top_conv=False}is ok, but{include_top_conv=True} is wrong. i think the problem is because unet.py in line 29,we should define input_shape,and deal with it by _custom_layers_and_blocks.py in line 78 through insert a line input_shape=[self.height, self.width, self.depth]

JanMarcelKezmann commented 3 years ago

I have tried to reproduce your code, but I simply do not receive an error message.

Did you use one of the examples as a guide or did you completely wrote the code from scratch? Further I would not only need the code but the full error message too, even though I understand the issue.

panker98 commented 3 years ago

I have tried to reproduce your code, but I simply do not receive an error message.

Did you use one of the examples as a guide or did you completely wrote the code from scratch? Further I would not only need the code but the full error message too, even though I understand the issue.

okay,i know why the error appeared!because i define the input shape in base model but not in unet model.so when i rewrite some code and add the input shape,when i create unet model it will work,not for my rewriting just because i define the input shape when i create unet model. i am so sorry for disturbing you. my error code { base_model, layers, layer_names = tasm.create_base_model(name="efficientnetb3", weights=None, height=KERNEL_SIZE, width=KERNEL_SIZE,depth=len(BANDS),include_top=False, pooling=None) model1 = tasm.UNet(n_classes=NUM_CLASSES, base_model=base_model, output_layers=layers, backbone_trainable=False,final_activation="softmax").model() } when i create other segmentation model by this way,it will work.however when i create unet model ,because include_top_conv=True,,so i should define input shape

JanMarcelKezmann commented 3 years ago

Okay, great that you could solve it by yourself. I guess I can close this issue now.