示例#1
0
    def __init__(self, version=None, **kwargs):
        super().__init__()
        assert version is not None, "DispResNet needs a version"

        num_layers = int(version[:2])       # First two characters are the number of layers
        pretrained = version[2:] == 'pt'    # If the last characters are "pt", use ImageNet pretraining
        assert num_layers in [18, 34, 50], 'ResNet version {} not available'.format(num_layers)

        self.encoder = ResnetEncoder(num_layers=num_layers, pretrained=pretrained)
        self.decoder = DepthDecoder(num_ch_enc=self.encoder.num_ch_enc)
        self.scale_inv_depth = partial(disp_to_depth, min_depth=0.1, max_depth=100.0)
示例#2
0
    def __init__(self, version=None, **kwargs):
        super().__init__()
        assert version is not None, "PoseResNet needs a version"

        num_layers = int(
            version[:2])  # First two characters are the number of layers
        pretrained = version[
            2:] == 'pt'  # If the last characters are "pt", use ImageNet pretraining
        assert num_layers in [
            18, 34, 50
        ], 'ResNet version {} not available'.format(num_layers)

        self.encoder = ResnetEncoder(num_layers=num_layers,
                                     pretrained=pretrained,
                                     num_input_images=2)
        self.decoder = PoseDecoder(self.encoder.num_ch_enc,
                                   num_input_features=1,
                                   num_frames_to_predict_for=2)