当前位置: 首页>>代码示例>>Python>>正文


Python utils.download方法代码示例

本文整理汇总了Python中utils.download方法的典型用法代码示例。如果您正苦于以下问题:Python utils.download方法的具体用法?Python utils.download怎么用?Python utils.download使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils的用法示例。


在下文中一共展示了utils.download方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import utils [as 别名]
# 或者: from utils import download [as 别名]
def main():

    # 1. download and unzip data
    download_data(data_dir)

    # 2. load data
    RV = import_data()

    # 3. split train, validation and test
    RV = split_data(RV)

    # 4. export
    out_file = os.path.join(data_dir, "data_faces.h5")
    fout = h5py.File(out_file, "w")
    for key in RV.keys():
        fout.create_dataset(key, data=RV[key])
    fout.close() 
开发者ID:fpcasale,项目名称:GPPVAE,代码行数:19,代码来源:process_data.py

示例2: make_audio

# 需要导入模块: import utils [as 别名]
# 或者: from utils import download [as 别名]
def make_audio(location, name, d_csv, start_idx, end_idx):
    for i in range(start_idx,end_idx):
        f_name = name + str(i)
        link = "https://www.youtube.com/watch?v="+d_csv.loc[i][0]
        start_time = d_csv.loc[i][1]
        end_time = start_time+3.0
        utils.download(location,f_name,link)
        utils.cut(location,f_name,start_time,end_time)
        print("\r Process audio... ".format(i) + str(i), end="")
    print("\r Finish !!", end="") 
开发者ID:JusperLee,项目名称:Looking-to-Listen-at-the-Cocktail-Party,代码行数:12,代码来源:audio_downloads.py

示例3: __init__

# 需要导入模块: import utils [as 别名]
# 或者: from utils import download [as 别名]
def __init__(self, root):
        self.root = root
        if not posixpath.exists(posixpath.join(self.root, self.ukbench_dir)):
            download(self.root, self.filename, self.url)
            unzip(self.root, self.filename, self.ukbench_dir)
        self.uris = sorted(list_files(root=posixpath.join(self.root,
                                                          self.ukbench_dir,
                                                          'full'),
                                      suffix=('png', 'jpg', 'jpeg', 'gif'))) 
开发者ID:yzhangcs,项目名称:SoTu,代码行数:11,代码来源:ukbench.py

示例4: __init__

# 需要导入模块: import utils [as 别名]
# 或者: from utils import download [as 别名]
def __init__(self, input_img):
        utils.download(VGG_DOWNLOAD_LINK, VGG_FILENAME, EXPECTED_BYTES)
        self.vgg_layers = scipy.io.loadmat(VGG_FILENAME)['layers']
        self.input_img = input_img
        self.mean_pixels = np.array([123.68, 116.779, 103.939]).reshape((1,1,1,3)) 
开发者ID:chiphuyen,项目名称:stanford-tensorflow-tutorials,代码行数:7,代码来源:load_vgg_sol.py

示例5: main

# 需要导入模块: import utils [as 别名]
# 或者: from utils import download [as 别名]
def main():
    with tf.variable_scope('input') as scope:
        # use variable instead of placeholder because we're training the intial image to make it
        # look like both the content image and the style image
        input_image = tf.Variable(np.zeros([1, IMAGE_HEIGHT, IMAGE_WIDTH, 3]), dtype=tf.float32)
    
    utils.download(VGG_DOWNLOAD_LINK, VGG_MODEL, EXPECTED_BYTES)
    utils.make_dir('checkpoints')
    utils.make_dir('outputs')
    model = vgg_model.load_vgg(VGG_MODEL, input_image)
    model['global_step'] = tf.Variable(0, dtype=tf.int32, trainable=False, name='global_step')
    
    content_image = utils.get_resized_image(CONTENT_IMAGE, IMAGE_HEIGHT, IMAGE_WIDTH)
    content_image = content_image - MEAN_PIXELS
    style_image = utils.get_resized_image(STYLE_IMAGE, IMAGE_HEIGHT, IMAGE_WIDTH)
    style_image = style_image - MEAN_PIXELS

    model['content_loss'], model['style_loss'], model['total_loss'] = _create_losses(model, 
                                                    input_image, content_image, style_image)
    ###############################
    ## TO DO: create optimizer
    ## model['optimizer'] = ...
    ###############################
    model['summary_op'] = _create_summary(model)

    initial_image = utils.generate_noise_image(content_image, IMAGE_HEIGHT, IMAGE_WIDTH, NOISE_RATIO)
    train(model, input_image, initial_image) 
开发者ID:chiphuyen,项目名称:stanford-tensorflow-tutorials,代码行数:29,代码来源:style_transfer.py

示例6: main

# 需要导入模块: import utils [as 别名]
# 或者: from utils import download [as 别名]
def main():
    with tf.variable_scope('input') as scope:
        # use variable instead of placeholder because we're training the intial image to make it
        # look like both the content image and the style image
        input_image = tf.Variable(np.zeros([1, IMAGE_HEIGHT, IMAGE_WIDTH, 3]), dtype=tf.float32)
    
    utils.download(VGG_DOWNLOAD_LINK, VGG_MODEL, EXPECTED_BYTES)
    utils.make_dir('checkpoints')
    utils.make_dir('outputs')
    model = vgg_model.load_vgg(VGG_MODEL, input_image)
    model['global_step'] = tf.Variable(0, dtype=tf.int32, trainable=False, name='global_step')

    content_image = utils.get_resized_image(CONTENT_IMAGE, IMAGE_HEIGHT, IMAGE_WIDTH)
    content_image = content_image - MEAN_PIXELS
    style_image = utils.get_resized_image(STYLE_IMAGE, IMAGE_HEIGHT, IMAGE_WIDTH)
    style_image = style_image - MEAN_PIXELS

    model['content_loss'], model['style_loss'], model['total_loss'] = _create_losses(model, 
                                                    input_image, content_image, style_image)
    ###############################
    ## TO DO: create optimizer
    model['optimizer'] = tf.train.AdamOptimizer(LR).minimize(model['total_loss'], 
                                                            global_step=model['global_step'])
    ###############################
    model['summary_op'] = _create_summary(model)

    initial_image = utils.generate_noise_image(content_image, IMAGE_HEIGHT, IMAGE_WIDTH, NOISE_RATIO)
    train(model, input_image, initial_image) 
开发者ID:chiphuyen,项目名称:stanford-tensorflow-tutorials,代码行数:30,代码来源:style_transfer.py


注:本文中的utils.download方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。