forked from PaddlePaddle/PaddleClas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
952 additions
and
0 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
ppcls/arch/backbone/legendary_models/open_clip/__init__.py
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,96 @@ | ||
import os | ||
import wget | ||
import paddle | ||
from .model_CLIP import CLIP, LaCLIP | ||
from paddle.vision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize | ||
from .unicom import load_model | ||
|
||
|
||
def clip_rn50(): | ||
model = CLIP( | ||
embed_dim=1024, | ||
image_resolution=224, | ||
vision_layers=(3, 4, 6, 3), | ||
vision_width=64, | ||
vision_patch_size=None, | ||
vision_head=64, | ||
context_length=77, | ||
vocab_size=49408, | ||
transformer_width=512, | ||
transformer_heads=8, | ||
transformer_layers=12) | ||
return model | ||
|
||
|
||
def clip_vit_b_32(): | ||
model = CLIP( | ||
embed_dim=512, | ||
image_resolution=224, | ||
vision_layers=12, | ||
vision_width=768, | ||
vision_patch_size=32, | ||
vision_head=64, | ||
context_length=77, | ||
vocab_size=49408, | ||
transformer_width=512, | ||
transformer_heads=8, | ||
transformer_layers=12) | ||
return model | ||
|
||
|
||
def clip_vit_b_16(): | ||
model = CLIP( | ||
embed_dim=512, | ||
image_resolution=224, | ||
vision_layers=12, | ||
vision_width=768, | ||
vision_patch_size=16, | ||
vision_head=64, | ||
context_length=77, | ||
vocab_size=49408, | ||
transformer_width=512, | ||
transformer_heads=8, | ||
transformer_layers=12) | ||
return model | ||
|
||
|
||
def Laclip_vit_b_32(): | ||
model = LaCLIP( | ||
embed_dim=512, | ||
image_resolution=224, | ||
vision_layers=12, | ||
vision_width=768, | ||
vision_patch_size=32, | ||
vision_head=64, | ||
context_length=77, | ||
vocab_size=49408, | ||
transformer_width=512, | ||
transformer_heads=8, | ||
transformer_layers=12) | ||
return model | ||
|
||
|
||
def Laclip_vit_b_16(): | ||
model = LaCLIP( | ||
embed_dim=512, | ||
image_resolution=224, | ||
vision_layers=12, | ||
vision_width=768, | ||
vision_patch_size=16, | ||
vision_head=64, | ||
context_length=77, | ||
vocab_size=49408, | ||
transformer_width=512, | ||
transformer_heads=8, | ||
transformer_layers=12) | ||
return model | ||
|
||
|
||
def unicom_vit_b_32(): | ||
model = load_model("ViT-B/32") | ||
return model | ||
|
||
|
||
def Laclip_vit_b_16(): | ||
model = load_model("ViT-B/16") | ||
return model |
Oops, something went wrong.