本文整理汇总了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()
示例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="")
示例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')))
示例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))
示例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)
示例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)