Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the final prediction head #21

Open
limyunn opened this issue Nov 4, 2022 · 4 comments
Open

About the final prediction head #21

limyunn opened this issue Nov 4, 2022 · 4 comments

Comments

@limyunn
Copy link

limyunn commented Nov 4, 2022

Hi , when reading your code about the model head (define number of output classes) ,I have some question about this. In 2D segmentation task , we usually use Conv2D with kernel size 1 to get the final segmentaion mask. However, in this library, I notice that Conv3D with kernel size 3 has been used to get the final prediction rather than kernel size 1. I'm just wondering is there difference between Conv3D with kernel size 3 and 1 to get the prediction in 3D segmentation task?

@ZFTurbo
Copy link
Owner

ZFTurbo commented Nov 4, 2022

Can you please send link on code with line?

@limyunn
Copy link
Author

limyunn commented Nov 4, 2022

the code is from this script : segmentation_models_3D/models/unet.py

model head (define number of output classes)

x = layers.Conv3D(
    filters=classes,
    kernel_size=(3, 3, 3),
    padding='same',
    use_bias=True,
    kernel_initializer='glorot_uniform',
    name='final_conv',
)(x)

@ZFTurbo
Copy link
Owner

ZFTurbo commented Nov 4, 2022

@limyunn
Copy link
Author

limyunn commented Nov 5, 2022

Thanks, as I have seen, most of the prediction head in Unet have implemented Conv2D with kernel size 1. So I am not sure if the kernel size 3 or 1 will affect the final prediction.
Here is the original version from the author of Unet:
https://github.com/zhixuhao/unet/blob/b45af4d458437d8281cc218a07fd4380818ece4a/model.py#L53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants