當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。