File size: 1,022 Bytes
8b4c6c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from detectron2.config import LazyCall as L

from modeling import Detail_Capture, MattingCriterion
from modeling.meta_arch import SamHqMatte
from modeling.semantic_enhanced_matting.build_sam import sam_model_registry_def
# from modeling.sam_hq_matting.predictor import SamPredictor
from modeling.semantic_enhanced_matting import MaskDecoderMatting

mask_token_only = False

model = L(SamHqMatte)(

    # original sam_hq
    sam_model = L(sam_model_registry_def)(
        model_type = 'vit_b',
        checkpoint = None,
    ),
    hq_token_only = True,
    hq_features_type = 'Final',
    multimask_output = True,

    # loss function
    criterion=L(MattingCriterion)(
        losses = ['unknown_l1_loss', 'known_l1_loss', 'loss_pha_laplacian', 'loss_gradient_penalty']
    ),
    
    # other params.
    pixel_mean = [123.675 / 255., 116.280 / 255., 103.530 / 255.],
    pixel_std = [58.395 / 255., 57.120 / 255., 57.375 / 255.],

    lora_rank = None,
    lora_alpha = None,
    w_dora = False,
    w_rslora = False,
)