-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
83 lines (78 loc) · 2.93 KB
/
config.py
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
_base_ = [
'../_base_/datasets/coco_panoptic.py', '../_base_/default_runtime.py'
]
# plugin = True
# plugin_name = '.projects.instance_segment_anything'
# plugin_package = 'Instance-Segment-Anything'
model = dict(
type='DetWrapperInstanceSAM',
det_wrapper_type='hdetr',
det_wrapper_cfg=dict(aux_loss=False,
backbone='swin_large',
num_classes=91,
cache_mode=False,
dec_layers=6,
dec_n_points=4,
dilation=False,
dim_feedforward=2048,
drop_path_rate=0.5,
dropout=0.0,
enc_layers=6,
enc_n_points=4,
focal_alpha=0.25,
frozen_weights=None,
hidden_dim=256,
k_one2many=6,
lambda_one2many=1.0,
look_forward_twice=True,
masks=False,
mixed_selection=True,
nheads=8,
num_feature_levels=4,
num_queries_one2many=1500,
num_queries_one2one=900,
position_embedding='sine',
position_embedding_scale=6.283185307179586,
remove_difficult=False,
topk=300,
two_stage=True,
use_checkpoint=False,
use_fp16=False,
use_wandb=False,
with_box_refine=True),
det_model_ckpt='ckpt/swin_l_hdetr.pth',
num_classes=80,
model_type='vit_h',
sam_checkpoint='ckpt/sam_vit_h_4b8939.pth',
use_sam_iou=True,
)
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
# test_pipeline, NOTE the Pad's size_divisor is different from the default
# setting (size_divisor=32). While there is little effect on the performance
# whether we use the default setting or use size_divisor=1.
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(1333, 800),
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=1),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img'])
])
]
dataset_type = 'CocoDataset'
data_root = '/root/autodl-tmp/COCO2017/'
data = dict(
samples_per_gpu=1,
workers_per_gpu=1,
test=dict(
type=dataset_type,
ann_file=data_root + 'annotations/instances_val2017.json',
img_prefix=data_root + 'val2017/',
pipeline=test_pipeline))