欧美性猛交xxxx免费看_牛牛在线视频国产免费_天堂草原电视剧在线观看免费_国产粉嫩高清在线观看_国产欧美日本亚洲精品一5区

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

一個(gè)實(shí)用的GitHub項(xiàng)目:TensorFlow-Cookbook

DPVg_AI_era ? 來源:lq ? 2019-02-19 09:04 ? 次閱讀

今天為大家推薦一個(gè)實(shí)用的GitHub項(xiàng)目:TensorFlow-Cookbook。 這是一個(gè)易用的TensorFlow代碼集,包含了對(duì)GAN有用的一些通用架構(gòu)和函數(shù)。

今天為大家推薦一個(gè)實(shí)用的GitHub項(xiàng)目:TensorFlow-Cookbook。

這是一個(gè)易用的TensorFlow代碼集,作者是來自韓國(guó)的AI研究科學(xué)家Junho Kim,內(nèi)容涵蓋了譜歸一化卷積、部分卷積、pixel shuffle、幾種歸一化函數(shù)、 tf-datasetAPI,等等。

作者表示,這個(gè)repo包含了對(duì)GAN有用的一些通用架構(gòu)和函數(shù)。

項(xiàng)目正在進(jìn)行中,作者將持續(xù)為其他領(lǐng)域添加有用的代碼,目前正在添加的是 tf-Eager mode的代碼。歡迎提交pull requests和issues。

Github地址 :

https://github.com/taki0112/Tensorflow-Cookbook

如何使用

Import

ops.py

operations

from ops import *

utils.py

image processing

from utils import *

Network template

def network(x, is_training=True, reuse=False, scope="network"): with tf.variable_scope(scope, reuse=reuse): x = conv(...) ... return logit

使用DatasetAPI向網(wǎng)絡(luò)插入數(shù)據(jù)

Image_Data_Class = ImageData(img_size, img_ch, augment_flag) trainA = trainA.map(Image_Data_Class.image_processing, num_parallel_calls=16) trainA = trainA.shuffle(buffer_size=10000).prefetch(buffer_size=batch_size).batch(batch_size).repeat() trainA_iterator = trainA.make_one_shot_iterator() data_A = trainA_iterator.get_next() logit = network(data_A)

了解更多,請(qǐng)閱讀:

https://github.com/taki0112/Tensorflow-DatasetAPI

Option

padding='SAME'

pad = ceil[ (kernel - stride) / 2 ]

pad_type

'zero' or 'reflect'

sn

usespectral_normalizationor not

Ra

userelativistic ganor not

loss_func

gan

lsgan

hinge

wgan

wgan-gp

dragan

注意

如果你不想共享變量,請(qǐng)以不同的方式設(shè)置所有作用域名稱。

權(quán)重(Weight)

weight_init = tf.truncated_normal_initializer(mean=0.0, stddev=0.02) weight_regularizer = tf.contrib.layers.l2_regularizer(0.0001) weight_regularizer_fully = tf.contrib.layers.l2_regularizer(0.0001)

初始化(Initialization)

Xavier: tf.contrib.layers.xavier_initializer()

He: tf.contrib.layers.variance_scaling_initializer()

Normal: tf.random_normal_initializer(mean=0.0, stddev=0.02)

Truncated_normal: tf.truncated_normal_initializer(mean=0.0, stddev=0.02)

Orthogonal: tf.orthogonal_initializer(1.0) / # if relu = sqrt(2), the others = 1.0

正則化(Regularization)

l2_decay: tf.contrib.layers.l2_regularizer(0.0001)

orthogonal_regularizer: orthogonal_regularizer(0.0001) & orthogonal_regularizer_fully(0.0001)

卷積(Convolution)

basic conv

x = conv(x, channels=64, kernel=3, stride=2, pad=1, pad_type='reflect', use_bias=True, sn=True, scope='conv')

partial conv (NVIDIAPartial Convolution)

x = partial_conv(x, channels=64, kernel=3, stride=2, use_bias=True, padding='SAME', sn=True, scope='partial_conv')

dilated conv

x = dilate_conv(x, channels=64, kernel=3, rate=2, use_bias=True, padding='SAME', sn=True, scope='dilate_conv')

Deconvolution

basic deconv

x = deconv(x, channels=64, kernel=3, stride=2, padding='SAME', use_bias=True, sn=True, scope='deconv')

Fully-connected

x = fully_conneted(x, units=64, use_bias=True, sn=True, scope='fully_connected')

Pixel shuffle

x = conv_pixel_shuffle_down(x, scale_factor=2, use_bias=True, sn=True, scope='pixel_shuffle_down') x = conv_pixel_shuffle_up(x, scale_factor=2, use_bias=True, sn=True, scope='pixel_shuffle_up')

down===> [height, width] -> [height // scale_factor, width // scale_factor]

up===> [height, width] -> [height * scale_factor, width * scale_factor]

Block

residual block

x = resblock(x, channels=64, is_training=is_training, use_bias=True, sn=True, scope='residual_block') x = resblock_down(x, channels=64, is_training=is_training, use_bias=True, sn=True, scope='residual_block_down') x = resblock_up(x, channels=64, is_training=is_training, use_bias=True, sn=True, scope='residual_block_up')

down===> [height, width] -> [height // 2, width // 2]

up===> [height, width] -> [height * 2, width * 2]

attention block

x = self_attention(x, channels=64, use_bias=True, sn=True, scope='self_attention') x = self_attention_with_pooling(x, channels=64, use_bias=True, sn=True, scope='self_attention_version_2') x = squeeze_excitation(x, channels=64, ratio=16, use_bias=True, sn=True, scope='squeeze_excitation') x = convolution_block_attention(x, channels=64, ratio=16, use_bias=True, sn=True, scope='convolution_block_attention')

Normalization

Normalization

x = batch_norm(x, is_training=is_training, scope='batch_norm') x = instance_norm(x, scope='instance_norm') x = layer_norm(x, scope='layer_norm') x = group_norm(x, groups=32, scope='group_norm') x = pixel_norm(x) x = batch_instance_norm(x, scope='batch_instance_norm') x = condition_batch_norm(x, z, is_training=is_training, scope='condition_batch_norm'): x = adaptive_instance_norm(x, gamma, beta):

如何使用condition_batch_norm,請(qǐng)參考:

https://github.com/taki0112/BigGAN-Tensorflow

如何使用adaptive_instance_norm,請(qǐng)參考:

https://github.com/taki0112/MUNIT-Tensorflow

Activation

x = relu(x) x = lrelu(x, alpha=0.2) x = tanh(x) x = sigmoid(x) x = swish(x)

Pooling & Resize

x = up_sample(x, scale_factor=2) x = max_pooling(x, pool_size=2) x = avg_pooling(x, pool_size=2) x = global_max_pooling(x) x = global_avg_pooling(x) x = flatten(x) x = hw_flatten(x)

Loss

classification loss

loss, accuracy = classification_loss(logit, label)

pixel loss

loss = L1_loss(x, y) loss = L2_loss(x, y) loss = huber_loss(x, y) loss = histogram_loss(x, y)

histogram_loss表示圖像像素值在顏色分布上的差異。

gan loss

d_loss = discriminator_loss(Ra=True, loss_func='wgan-gp', real=real_logit, fake=fake_logit) g_loss = generator_loss(Ra=True, loss_func='wgan_gp', real=real_logit, fake=fake_logit)

如何使用gradient_penalty,請(qǐng)參考:

https://github.com/taki0112/BigGAN-Tensorflow/blob/master/BigGAN_512.py#L180

kl-divergence (z ~ N(0, 1))

loss = kl_loss(mean, logvar)

Author

Junho Kim

Github地址 :

https://github.com/taki0112/Tensorflow-Cookbook

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 函數(shù)
    +關(guān)注

    關(guān)注

    3

    文章

    4346

    瀏覽量

    62990
  • GitHub
    +關(guān)注

    關(guān)注

    3

    文章

    473

    瀏覽量

    16597
  • tensorflow
    +關(guān)注

    關(guān)注

    13

    文章

    329

    瀏覽量

    60634

原文標(biāo)題:【收藏】簡(jiǎn)單易用 TensorFlow 代碼集,GAN通用框架、函數(shù)

文章出處:【微信號(hào):AI_era,微信公眾號(hào):新智元】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。

收藏 人收藏

    評(píng)論

    相關(guān)推薦

    如何使用tensorflow快速搭建起個(gè)深度學(xué)習(xí)項(xiàng)目

    我們繼續(xù)以 NG 課題組提供的 sign 手勢(shì)數(shù)據(jù)集為例,學(xué)習(xí)如何通過Tensorflow快速搭建起個(gè)深度學(xué)習(xí)項(xiàng)目。數(shù)據(jù)集標(biāo)簽共有零到五總共 6 類標(biāo)簽,示例如下
    的頭像 發(fā)表于 10-25 08:57 ?7743次閱讀

    干貨 | TensorFlow的55個(gè)經(jīng)典案例

    ://yann.lecun.com/exdb/mnist/第二步:為TF新手準(zhǔn)備的各個(gè)類型的案例、模型和數(shù)據(jù)集初步了解:TFLearn TensorFlow接下來的示例來自TFLearn,這是個(gè)
    發(fā)表于 10-09 11:28

    TensorFlow是什么

    來發(fā)現(xiàn)和理解瀕臨滅絕的海牛。位日本農(nóng)民運(yùn)用 TensorFlow 開發(fā)了個(gè)應(yīng)用程序,使用大小和形狀等物理特性對(duì)黃瓜進(jìn)行分類。使用 Tensor
    發(fā)表于 07-22 10:14

    TensorFlow的特點(diǎn)和基本的操作方式

    Tensorflow是Google開源的深度學(xué)習(xí)框架,來自于Google Brain研究項(xiàng)目,在Google第代分布式機(jī)器學(xué)習(xí)框架DistBelief的基礎(chǔ)上發(fā)展起來。Tensorflow
    發(fā)表于 11-23 09:56

    The VHDL Cookbook

    The VHDL Cookbook 好東西哦。網(wǎng)上搜集,希望對(duì)你有用。
    發(fā)表于 03-25 14:37 ?19次下載

    github入門到上傳本地項(xiàng)目步驟

    GitHub可以托管各種git庫,并提供個(gè)web界面,但與其它像 SourceForge或Google Code這樣的服務(wù)不同,GitHub的獨(dú)特賣點(diǎn)在于從另外
    發(fā)表于 11-29 16:51 ?2243次閱讀

    github使用教程_github菜鳥教程

    GitHub 擁有個(gè)非常鼓勵(lì)合作的社區(qū)氛圍。這方面源于 GitHub 的付費(fèi)模式:私有項(xiàng)目
    發(fā)表于 11-29 17:22 ?1.5w次閱讀
    <b class='flag-5'>github</b>使用教程_<b class='flag-5'>github</b>菜鳥教程

    提出個(gè)快速啟動(dòng)自己的 TensorFlow 項(xiàng)目模板

    簡(jiǎn)潔而精密的結(jié)構(gòu)對(duì)于深度學(xué)習(xí)項(xiàng)目來說是必不可少的,在經(jīng)過多次練習(xí)和 TensorFlow 項(xiàng)目開發(fā)之后,本文作者提出了個(gè)結(jié)合簡(jiǎn)便性、優(yōu)化文
    的頭像 發(fā)表于 02-07 11:47 ?3214次閱讀
    提出<b class='flag-5'>一</b><b class='flag-5'>個(gè)</b>快速啟動(dòng)自己的 <b class='flag-5'>TensorFlow</b> <b class='flag-5'>項(xiàng)目</b>模板

    總結(jié)Tensorflow純干貨學(xué)習(xí)資源,分為教程、視頻和項(xiàng)目三大板塊

    基于Facebook中FastText的簡(jiǎn)單嵌入式文本分類器:https://github.com/apcode/tensorflow_fasttext。該項(xiàng)目是源于Facebook中
    的頭像 發(fā)表于 04-16 11:39 ?1.1w次閱讀

    人工智能涼了? GitHub年度報(bào)告揭示真相

    去年GitHub的報(bào)告中,人工智能非?;?。今年情況如何?在下面的圖表中,可以看到: Tensorflow在最熱開源項(xiàng)目中排第三;在增長(zhǎng)最快的項(xiàng)目中Pytorch排名第二,
    的頭像 發(fā)表于 10-23 10:16 ?3559次閱讀

    總結(jié)GitHub熱門開源項(xiàng)目

    個(gè)項(xiàng)目的熱門程度,較為直觀的判斷方式就是它的Stars增長(zhǎng)速度,排行第的flutter依然是Google家的,F(xiàn)lutter 是在2018年的2月份才推出第
    的頭像 發(fā)表于 01-18 14:15 ?2978次閱讀

    GitHub年度報(bào)告:Python首次擊敗Java

    作為 GitHub 上最受歡迎的項(xiàng)目,TensorFlow 已經(jīng)建立了個(gè)龐大的軟件社區(qū)。去
    的頭像 發(fā)表于 11-22 15:14 ?2491次閱讀

    TensorFlow Community Spotlight獲獎(jiǎng)項(xiàng)目

    Spotlight 獲獎(jiǎng)?wù)?,她?TensorFlow 開發(fā)出款追蹤坐姿的工具,當(dāng)使用者坐姿不正確的情況下屏幕會(huì)變模糊 在這四個(gè)
    的頭像 發(fā)表于 11-26 09:43 ?1873次閱讀

    上傳本地項(xiàng)目代碼到github

    GitHub個(gè)面向開源及私有軟件項(xiàng)目的托管平臺(tái),因?yàn)橹恢С謌it 作為唯的版本庫格式進(jìn)行托管,故名
    的頭像 發(fā)表于 11-14 16:45 ?1109次閱讀
    上傳本地<b class='flag-5'>項(xiàng)目</b>代碼到<b class='flag-5'>github</b>

    如何使用Github高效率的查找項(xiàng)目

    GitHub各位應(yīng)該都很熟悉了,全球最大的開源社區(qū),也是全球最大的同性交友網(wǎng)站~~,但是大部分同學(xué)使用GitHub應(yīng)該就是通過別人的開源鏈接,點(diǎn)進(jìn)去下載對(duì)應(yīng)的項(xiàng)目,而真正使用Github
    的頭像 發(fā)表于 09-24 14:43 ?749次閱讀
    如何使用<b class='flag-5'>Github</b>高效率的查找<b class='flag-5'>項(xiàng)目</b>