MCPcopy Create free account
hub / github.com/PolyU-ChenLab/UniPixel / __init__

Method __init__

sam2/modeling/memory_encoder.py:140–160  ·  view source on GitHub ↗
(
            self,
            out_dim,
            mask_downsampler,
            fuser,
            position_encoding,
            in_dim=256,  # in_dim of pix_feats
    )

Source from the content-addressed store, hash-verified

138class MemoryEncoder(nn.Module):
139
140 def __init__(
141 self,
142 out_dim,
143 mask_downsampler,
144 fuser,
145 position_encoding,
146 in_dim=256, # in_dim of pix_feats
147 ):
148 super().__init__()
149
150 self.mask_downsampler = mask_downsampler
151
152 self.pix_feat_proj = nn.Conv2d(in_dim, in_dim, kernel_size=1)
153 self.fuser = fuser
154 self.position_encoding = position_encoding
155 self.out_proj = nn.Identity()
156 if out_dim != in_dim:
157 self.out_proj = nn.Conv2d(in_dim, out_dim, kernel_size=1)
158
159 # save out_dim to avoid accessing model weights (breaks zero3)
160 self.out_dim = out_dim
161
162 def forward(
163 self,

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected