forked from qubvel-org/segmentation_models.pytorch
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove dependencies and add full timm support
- Loading branch information
1 parent
f4cb90a
commit e83fc41
Showing
42 changed files
with
5,537 additions
and
3,742 deletions.
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
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# tests | ||
pytest==7.4.4 | ||
pytest-cov==4.1.0 | ||
mock==5.1.0 | ||
six==1.16.0 | ||
pytest-cov==4.1.0 |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import json | ||
|
||
import timm | ||
from tqdm import tqdm | ||
|
||
if __name__ == "__main__": | ||
# Check for models that support `features_only=True`` | ||
works, fails = {}, [] | ||
for model in tqdm(timm.list_models()): | ||
try: | ||
m = timm.create_model(model, pretrained=False, features_only=True) | ||
works[model] = dict( | ||
indices=m.feature_info.out_indices, | ||
channels=m.feature_info.channels(), | ||
reduction=m.feature_info.reduction(), | ||
module=m.feature_info.module_name(), | ||
) | ||
except RuntimeError: | ||
fails.append(model) | ||
|
||
with open("encoders_features_only_supported.json", "w") as f: | ||
json.dump(works, f, indent=2) | ||
|
||
# Check for models that support `get_intermediate_layers`` | ||
intermediate_layers_support = [] | ||
unsupported = [] | ||
|
||
for model in tqdm(fails): | ||
m = timm.create_model(model, pretrained=False) | ||
if hasattr(m, "get_intermediate_layers"): | ||
intermediate_layers_support.append(model) | ||
else: | ||
unsupported.append(model) | ||
|
||
with open("encoders_get_intermediate_layers_supported.json", "w") as f: | ||
json.dump(intermediate_layers_support, f, indent=2) | ||
|
||
# Save unsupported timm models | ||
with open("encoders_unsupported.json", "w") as f: | ||
json.dump(unsupported, f, indent=2) |
Oops, something went wrong.