diff options
| author | zhang <zch921005@126.com> | 2022-06-23 23:11:56 +0800 |
|---|---|---|
| committer | zhang <zch921005@126.com> | 2022-06-23 23:11:56 +0800 |
| commit | 462bd2c944beed1667df30aa7fa626b972a5dfc9 (patch) | |
| tree | d4000b7217cada045bf27853787eb278d13b29f1 /cv | |
| parent | b2432d57f626a37ee790a83483bcc960048b0dac (diff) | |
pytorch hook
Diffstat (limited to 'cv')
| -rw-r--r-- | cv/pretrained/features.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cv/pretrained/features.py b/cv/pretrained/features.py new file mode 100644 index 0000000..f479126 --- /dev/null +++ b/cv/pretrained/features.py @@ -0,0 +1,17 @@ + +import timm +import torch +from torch import nn + + +model_name = 'xception41' +# model_name = 'resnet18' +model = timm.create_model(model_name, pretrained=True) + +input = torch.randn(2, 3, 299, 299) + +o1 = model(input) +print(o1.shape) + +o2 = model.forward_features(input) +print(o2.shape)
\ No newline at end of file |
