kelvinou01
commited on
Commit
•
3d3cb53
1
Parent(s):
0172050
Update handler
Browse files- GD_GLIGEN.png +0 -0
- GroundingDINO_SwinB.cfg.py +0 -43
- GroundingDINO_SwinT_OGC.cfg.py +0 -43
- art_dog_birthdaycake.png +0 -0
- demo_audio.mp3 +0 -0
- gdsd_example.png +0 -3
- groundingdino_swinb_cogcoor.pth +0 -3
- handler.py +8 -2
- pandas.png +0 -0
- sketch_person.png +0 -0
- groundingdino_swint_ogc.pth → weights/groundingdino_swint_ogc.pth +0 -0
GD_GLIGEN.png
DELETED
Binary file (481 kB)
|
|
GroundingDINO_SwinB.cfg.py
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
batch_size = 1
|
2 |
-
modelname = "groundingdino"
|
3 |
-
backbone = "swin_B_384_22k"
|
4 |
-
position_embedding = "sine"
|
5 |
-
pe_temperatureH = 20
|
6 |
-
pe_temperatureW = 20
|
7 |
-
return_interm_indices = [1, 2, 3]
|
8 |
-
backbone_freeze_keywords = None
|
9 |
-
enc_layers = 6
|
10 |
-
dec_layers = 6
|
11 |
-
pre_norm = False
|
12 |
-
dim_feedforward = 2048
|
13 |
-
hidden_dim = 256
|
14 |
-
dropout = 0.0
|
15 |
-
nheads = 8
|
16 |
-
num_queries = 900
|
17 |
-
query_dim = 4
|
18 |
-
num_patterns = 0
|
19 |
-
num_feature_levels = 4
|
20 |
-
enc_n_points = 4
|
21 |
-
dec_n_points = 4
|
22 |
-
two_stage_type = "standard"
|
23 |
-
two_stage_bbox_embed_share = False
|
24 |
-
two_stage_class_embed_share = False
|
25 |
-
transformer_activation = "relu"
|
26 |
-
dec_pred_bbox_embed_share = True
|
27 |
-
dn_box_noise_scale = 1.0
|
28 |
-
dn_label_noise_ratio = 0.5
|
29 |
-
dn_label_coef = 1.0
|
30 |
-
dn_bbox_coef = 1.0
|
31 |
-
embed_init_tgt = True
|
32 |
-
dn_labelbook_size = 2000
|
33 |
-
max_text_len = 256
|
34 |
-
text_encoder_type = "bert-base-uncased"
|
35 |
-
use_text_enhancer = True
|
36 |
-
use_fusion_layer = True
|
37 |
-
use_checkpoint = True
|
38 |
-
use_transformer_ckpt = True
|
39 |
-
use_text_cross_attention = True
|
40 |
-
text_dropout = 0.0
|
41 |
-
fusion_dropout = 0.0
|
42 |
-
fusion_droppath = 0.1
|
43 |
-
sub_sentence_present = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GroundingDINO_SwinT_OGC.cfg.py
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
batch_size = 1
|
2 |
-
modelname = "groundingdino"
|
3 |
-
backbone = "swin_T_224_1k"
|
4 |
-
position_embedding = "sine"
|
5 |
-
pe_temperatureH = 20
|
6 |
-
pe_temperatureW = 20
|
7 |
-
return_interm_indices = [1, 2, 3]
|
8 |
-
backbone_freeze_keywords = None
|
9 |
-
enc_layers = 6
|
10 |
-
dec_layers = 6
|
11 |
-
pre_norm = False
|
12 |
-
dim_feedforward = 2048
|
13 |
-
hidden_dim = 256
|
14 |
-
dropout = 0.0
|
15 |
-
nheads = 8
|
16 |
-
num_queries = 900
|
17 |
-
query_dim = 4
|
18 |
-
num_patterns = 0
|
19 |
-
num_feature_levels = 4
|
20 |
-
enc_n_points = 4
|
21 |
-
dec_n_points = 4
|
22 |
-
two_stage_type = "standard"
|
23 |
-
two_stage_bbox_embed_share = False
|
24 |
-
two_stage_class_embed_share = False
|
25 |
-
transformer_activation = "relu"
|
26 |
-
dec_pred_bbox_embed_share = True
|
27 |
-
dn_box_noise_scale = 1.0
|
28 |
-
dn_label_noise_ratio = 0.5
|
29 |
-
dn_label_coef = 1.0
|
30 |
-
dn_bbox_coef = 1.0
|
31 |
-
embed_init_tgt = True
|
32 |
-
dn_labelbook_size = 2000
|
33 |
-
max_text_len = 256
|
34 |
-
text_encoder_type = "bert-base-uncased"
|
35 |
-
use_text_enhancer = True
|
36 |
-
use_fusion_layer = True
|
37 |
-
use_checkpoint = True
|
38 |
-
use_transformer_ckpt = True
|
39 |
-
use_text_cross_attention = True
|
40 |
-
text_dropout = 0.0
|
41 |
-
fusion_dropout = 0.0
|
42 |
-
fusion_droppath = 0.1
|
43 |
-
sub_sentence_present = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
art_dog_birthdaycake.png
DELETED
Binary file (524 kB)
|
|
demo_audio.mp3
DELETED
Binary file (20.3 kB)
|
|
gdsd_example.png
DELETED
Git LFS Details
|
groundingdino_swinb_cogcoor.pth
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:46270f7a822e6906b655b729c90613e48929d0f2bb8b9b76fd10a856f3ac6ab7
|
3 |
-
size 938057991
|
|
|
|
|
|
|
|
handler.py
CHANGED
@@ -1,10 +1,16 @@
|
|
1 |
|
|
|
2 |
from typing import Dict, List, Any
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
class EndpointHandler():
|
5 |
-
def __init__(self
|
6 |
# Preload all the elements you are going to need at inference.
|
7 |
-
|
8 |
|
9 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
10 |
"""
|
|
|
1 |
|
2 |
+
import os
|
3 |
from typing import Dict, List, Any
|
4 |
+
from groundingdino.util.inference import load_model, load_image, predict, annotate
|
5 |
+
|
6 |
+
HOME = os.getcwd()
|
7 |
+
CONFIG_PATH = os.path.join(HOME, "GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py")
|
8 |
+
WEIGHTS_PATH = os.path.join(HOME, "weights", "groundingdino_swint_ogc.pth")
|
9 |
|
10 |
class EndpointHandler():
|
11 |
+
def __init__(self):
|
12 |
# Preload all the elements you are going to need at inference.
|
13 |
+
self.model = load_model(CONFIG_PATH, WEIGHTS_PATH)
|
14 |
|
15 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
16 |
"""
|
pandas.png
DELETED
Binary file (696 kB)
|
|
sketch_person.png
DELETED
Binary file (43 kB)
|
|
groundingdino_swint_ogc.pth → weights/groundingdino_swint_ogc.pth
RENAMED
File without changes
|