Esempio n. 1
0
def setup_pose_net(config, prepared, **kwargs):
    """
    Create a pose network

    Parameters
    ----------
    config : CfgNode
        Network configuration
    prepared : bool
        True if the network has been prepared before
    kwargs : dict
        Extra parameters for the network

    Returns
    -------
    pose_net : nn.Module
        Created pose network
    """
    print0(pcolor('PoseNet: %s' % config.name, 'yellow'))
    pose_net = load_class_args_create(
        config.name,
        paths=[
            'packnet_sfm.networks.pose',
        ],
        args={
            **config,
            **kwargs
        },
    )
    if not prepared and config.checkpoint_path is not '':
        pose_net = load_network(pose_net, config.checkpoint_path,
                                ['pose_net', 'pose_network'])
    return pose_net
Esempio n. 2
0
def setup_depth_net(config, prepared, **kwargs):
    """
    Create a depth network

    Parameters
    ----------
    config : CfgNode
        Network configuration
    prepared : bool
        True if the network has been prepared before
    kwargs : dict
        Extra parameters for the network

    Returns
    -------
    depth_net : nn.Module
        Create depth network
    """
    print0(pcolor("DepthNet: %s" % config.name, "yellow"))
    depth_net = load_class_args_create(
        config.name,
        paths=[
            "packnet_sfm.networks.depth",
        ],
        args={
            **config,
            **kwargs
        },
    )
    if not prepared and config.checkpoint_path is not "":
        depth_net = load_network(depth_net, config.checkpoint_path,
                                 ["depth_net", "disp_network"])
    return depth_net