class MaskCorr(Mask): def __init__(self, oSz=63): super(MaskCorr, self).__init__() self.oSz = oSz self.mask = DepthCorr(256, 256, self.oSz**2) def forward(self, z, x): return self.mask(z, x) def init_trt(self,fp16_mode,trt_weights_path): self.mask.init_trt(fp16_mode,trt_weights_path)
class UP(RPN): def __init__(self, anchor_num=5, feature_in=256, feature_out=256): super(UP, self).__init__() self.anchor_num = anchor_num self.feature_in = feature_in self.feature_out = feature_out self.cls_output = 2 * self.anchor_num self.loc_output = 4 * self.anchor_num self.cls = DepthCorr(feature_in, feature_out, self.cls_output) self.loc = DepthCorr(feature_in, feature_out, self.loc_output) def forward(self, z_f, x_f): cls = self.cls(z_f, x_f) loc = self.loc(z_f, x_f) return cls, loc def init_trt(self,fp16_mode,trt_weights_path): self.cls.init_trt(fp16_mode,trt_weights_path) self.loc.init_trt(fp16_mode,trt_weights_path)