File size: 2,267 Bytes
5b31094
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os

# Configurations
tag2text_dict = {
    "swin_14m": {
        "checkpoint_url": "https://huggingface.co/spaces/xinyu1205/Tag2Text/resolve/main/tag2text_swin_14m.pth",
        "checkpoint_file": "tag2text_swin_14m.pth",
    }
}

sam_dict = {
    "default": {
        "checkpoint_url": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
        "checkpoint_file": "sam_vit_h_4b8939.pth",
    },
    "vit_h": {
        "checkpoint_url": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
        "checkpoint_file": "sam_vit_h_4b8939.pth",
    },
    "vit_l": {
        "checkpoint_url": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth",
        "checkpoint_file": "sam_vit_l_0b3195.pth",
    },
    "vit_b": {
        "checkpoint_url": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth",
        "checkpoint_file": "sam_vit_b_01ec64.pth",
    },
}

dino_dict = {
    "swinb": {
        "repo_id": "ShilongLiu/GroundingDINO",
        "config_file": "GroundingDINO_SwinB.cfg.py",
        "checkpoint_file": "groundingdino_swinb_cogcoor.pth",
    },
    "swint_ogc": {
        "repo_id": "ShilongLiu/GroundingDINO",
        "config_file": "GroundingDINO_SwinT_OGC.cfg.py",
        "checkpoint_file": "groundingdino_swint_ogc.pth",
    },
}

default_sam = "default"
default_tag2text = "swin_14m"
default_dino = "swint_ogc"

root_dir = os.path.dirname(os.path.abspath(__file__))
weight_dir = "weights"
abs_weight_dir = os.path.join(root_dir, weight_dir)

tag2text_checkpoint = "tag2text_swin_14m.pth"
tag2text_url = "https://huggingface.co/spaces/xinyu1205/Tag2Text/resolve/main/tag2text_swin_14m.pth"
sam_checkpoint = "sam_vit_h_4b8939.pth"
sam_url = "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth"
output_dir = "outputs"

dino_config_file = "GroundingDINO_SwinB.cfg.py"
dino_repo_id = "ShilongLiu/GroundingDINO"
dino_checkpoint = "groundingdino_swinb_cogcoor.pth"

iou_threshold = 0.5
box_threshold = 0.3
text_threshold = 0.25

# filter out attributes and action categories which are difficult to grounding
delete_tag_index = []
for i in range(3012, 3429):
    delete_tag_index.append(i)