MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / __init__

Method __init__

ldm/modules/midas/midas/dpt_depth.py:27–64  ·  view source on GitHub ↗
(
        self,
        head,
        features=256,
        backbone="vitb_rn50_384",
        readout="project",
        channels_last=False,
        use_bn=False,
    )

Source from the content-addressed store, hash-verified

25
26class DPT(BaseModel):
27 def __init__(
28 self,
29 head,
30 features=256,
31 backbone="vitb_rn50_384",
32 readout="project",
33 channels_last=False,
34 use_bn=False,
35 ):
36
37 super(DPT, self).__init__()
38
39 self.channels_last = channels_last
40
41 hooks = {
42 "vitb_rn50_384": [0, 1, 8, 11],
43 "vitb16_384": [2, 5, 8, 11],
44 "vitl16_384": [5, 11, 17, 23],
45 }
46
47 # Instantiate backbone and reassemble blocks
48 self.pretrained, self.scratch = _make_encoder(
49 backbone,
50 features,
51 False, # Set to true of you want to train from scratch, uses ImageNet weights
52 groups=1,
53 expand=False,
54 exportable=False,
55 hooks=hooks[backbone],
56 use_readout=readout,
57 )
58
59 self.scratch.refinenet1 = _make_fusion_block(features, use_bn)
60 self.scratch.refinenet2 = _make_fusion_block(features, use_bn)
61 self.scratch.refinenet3 = _make_fusion_block(features, use_bn)
62 self.scratch.refinenet4 = _make_fusion_block(features, use_bn)
63
64 self.scratch.output_conv = head
65
66
67 def forward(self, x):

Callers 1

__init__Method · 0.45

Calls 2

_make_encoderFunction · 0.85
_make_fusion_blockFunction · 0.85

Tested by

no test coverage detected