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

Can I use my own custom feature extraction model to export to the backbone? #586

Open
emrullahpolat opened this issue May 8, 2024 · 3 comments

Comments

@emrullahpolat
Copy link

emrullahpolat commented May 8, 2024

Hello, I want to use the UNet of Segmentation Model, I tried VGG and effnetB3 to add backbone. I wonder if I can add my own Keras feature extraction model. For example ;

`feature_extract_model = tf.keras.models.Sequential([

tf.keras.layers.Conv2D(128, (5, 5), strides=(4, 4), activation='relu', input_shape=(image_width, image_height, 3)),
tf.keras.layers.BatchNormalization(),
tf.keras.layers.MaxPooling2D(3, strides=(2, 2)),

tf.keras.layers.Conv2D(256, (3, 3), strides=(1, 1), activation='relu', padding='same'),
tf.keras.layers.BatchNormalization(),


tf.keras.layers.Conv2D(128, (5, 5), strides=(1, 1), activation='relu', padding='same'),
tf.keras.layers.BatchNormalization(),
tf.keras.layers.MaxPooling2D(3, strides=(2, 2))
])

model = sm.Linknet(BACKBONE=feature_extract_model , classes=n_classes, activation=activation, encoder_weights=None, encoder_freeze=True)

Do you think It is true?

@qubvel
Copy link
Owner

qubvel commented May 8, 2024

Hi @emrullahpolat, unfortunately, it is not that trivial, but you can do it.
Here is an example https://segmentation-models-pytorch.readthedocs.io/en/latest/insights.html#creating-your-own-encoder

@emrullahpolat
Copy link
Author

Thanks @qubvel, Can I use the these codes Keras backend? It seems as Pytorch.

@qubvel
Copy link
Owner

qubvel commented May 8, 2024

Not sure if you can, I don't have experience with Keras+(Pytorch backend). Let me know if you will be able to use it :)

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