This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Replace HRNet with SEResNet model in the notebook #362
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
34cad58
replaced HRNet with SEResNet model in the notebook
maxkazmsft 5a58953
removed debugging cell info
maxkazmsft ad0c504
Merge branch 'staging' into seresnet
maxkazmsft 4a47d56
Merge branch 'staging' into seresnet
maxkazmsft 9bdcc04
fixed bug where resnet_unet model wasn't loading the pre-trained vers…
maxkazmsft 2a58589
Merge branch 'seresnet' of github.com:microsoft/seismic-deeplearning …
maxkazmsft 13a3854
fixed build VM problems
maxkazmsft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -328,23 +328,23 @@ def download_pretrained_model(config): | |
raise NameError( | ||
"Unknown dataset name. Only dutch f3 and penobscot are currently supported." | ||
) | ||
|
||
if "hrnet" in config.MODEL.NAME: | ||
model = "hrnet" | ||
elif "deconvnet" in config.MODEL.NAME: | ||
model = "deconvnet" | ||
elif "unet" in config.MODEL.NAME: | ||
model = "unet" | ||
elif "resnet" in config.MODEL.NAME: | ||
model = "seresnetunet" | ||
else: | ||
raise NameError( | ||
"Unknown model name. Only hrnet, deconvnet, and unet are currently supported." | ||
"Unknown model name. Only hrnet, deconvnet, and seresnet_unet are currently supported." | ||
) | ||
|
||
# check if the user already supplied a URL, otherwise figure out the URL | ||
if validators.url(config.MODEL.PRETRAINED): | ||
if "PRETRAINED" in config.MODEL.keys() and validators.url(config.MODEL.PRETRAINED): | ||
url = config.MODEL.PRETRAINED | ||
print(f"Will use user-supplied URL of '{url}'") | ||
elif os.path.isfile(config.MODEL.PRETRAINED): | ||
elif "PRETRAINED" in config.MODEL.keys() and os.path.isfile(config.MODEL.PRETRAINED): | ||
url = None | ||
print(f"Will use user-supplied file on local disk of '{config.MODEL.PRETRAINED}'") | ||
else: | ||
|
@@ -371,19 +371,20 @@ def download_pretrained_model(config): | |
and config.TRAIN.DEPTH == "none" | ||
): | ||
url = "http://deepseismicsharedstore.blob.core.windows.net/master-public-models/dutchf3_deconvnetskip_patch_no_depth.pth" | ||
|
||
elif ( | ||
model == "deconvnet" | ||
and "skip" not in config.MODEL.NAME | ||
and config.TRAIN.DEPTH == "none" | ||
): | ||
url = "http://deepseismicsharedstore.blob.core.windows.net/master-public-models/dutchf3_deconvnet_patch_no_depth.pth" | ||
elif model == "unet" and config.TRAIN.DEPTH == "section": | ||
url = "http://deepseismicsharedstore.blob.core.windows.net/master-public-models/dutchf3_seresnetunet_patch_section_depth.pth" | ||
url = "http://deepseismicsharedstore.blob.core.windows.net/master-public-models/dutchf3_deconvnet_patch_no_depth.pth" | ||
elif model == "seresnetunet" and config.TRAIN.DEPTH == "section": | ||
url = "https://deepseismicsharedstore.blob.core.windows.net/master-public-models/dutchf3_seresnetunet_patch_section_depth.pth" | ||
else: | ||
raise NotImplementedError( | ||
"We don't store a pretrained model for Dutch F3 for this model combination yet." | ||
) | ||
|
||
|
||
else: | ||
raise NotImplementedError( | ||
"We don't store a pretrained model for this dataset/model combination yet." | ||
|
@@ -424,6 +425,11 @@ def download_pretrained_model(config): | |
# Update config MODEL.PRETRAINED | ||
# TODO: Only HRNet uses a pretrained model currently. | ||
# issue https://github.com/microsoft/seismic-deeplearning/issues/267 | ||
|
||
# now that we have a pre-trained model, we can set it | ||
if "PRETRAINED" not in config.MODEL.keys(): | ||
config.MODEL["PRETRAINED"] = "dummy" | ||
|
||
opts = [ | ||
Comment on lines
426
to
433
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it true that only HRnet has a pretrained model? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a key placeholder because we need to add a PRETRAINED key - we check the path later in the code so this can literally be anything |
||
"MODEL.PRETRAINED", | ||
pretrained_model_path, | ||
|
@@ -432,6 +438,7 @@ def download_pretrained_model(config): | |
"TEST.MODEL_PATH", | ||
pretrained_model_path, | ||
] | ||
|
||
config.merge_from_list(opts) | ||
|
||
return config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be "seresnet" or "resnet_unet" ?
we might have other models that have a resent backbone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disabled unet as we don't have / provide a pre-trained model with it