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

Add a function terratorch.create_model() #364

Open
blumenstiel opened this issue Jan 13, 2025 · 0 comments
Open

Add a function terratorch.create_model() #364

blumenstiel opened this issue Jan 13, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@blumenstiel
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Currently, TerraTorch has no user-friedly way to create full models. Also, directly calling the registry does not look very nice IMHO:

model = BACKBONE_REGISTRY.build("prithvi_vit_100")

Describe the solution you'd like
It would be good if we add a funktion terratorch.create_model() similar to timm:

model = timm.create_model('resnet34')

The default could be a simple wrapper around BACKBONE_REGISTRY.build. If a user passes additional parameters like task='classification', TerraTorch could automatically build a suitable model by selecting good default necks, decoders, and heads. Similar, passing task='segmentation' could return a PixelWiseModel. E.g.:

model = terratorch.create_model(
    'prithvi_eo_v2_300', 
    pretrained=True, 
    task='segmentation', 
    num_classes=2,
    decoder='UperNetDecoder'
)

Challenges
This might require that registered backbones come with a attribute for suitable default necks. E.g. we could add default necks to our registered models to always return 4 (intermediate) layers with reshaped 2D patch embeddings. This would help a lot of users independed of this feature request. Of course, users can overwrite these default necks.

@blumenstiel blumenstiel added the enhancement New feature or request label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant