def find_last_checkpoint(save_dir, net_type='G'):
    """
    # ---------------------------------------
    # Kai Zhang (github: https://github.com/cszn)
    # 03/Mar/2019
    # ---------------------------------------
    Args:
        save_dir: model folder
        net_type: 'G' or 'D'

    Return:
        init_iter: iteration number
        init_path: model path
    # ---------------------------------------
    """
    file_list = glob.glob(os.path.join(save_dir, '*_{}.pth'.format(net_type)))
    if file_list:
        iter_exist = []
        for file_ in file_list:
            iter_current = re.findall(r"(\d+)_{}.pth".format(net_type), file_)
            iter_exist.append(int(iter_current[0]))
        init_iter = max(iter_exist)
        init_path = os.path.join(save_dir, '{}_{}.pth'.format(init_iter, net_type))
    else:
        init_iter = 0
        init_path = None
    return init_iter, init_path

    # ---------------------------------------
    # Kai Zhang (github: https://github.com/cszn)
    # 03/Mar/2019
    # ---------------------------------------
    Args:
        save_dir: model folder
        net_type: 'G' or 'D'

    Return:
        init_iter: iteration number
        init_path: model path
    # ---------------------------------------
    
utils/utils_model.py