色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
电子发烧友
开通电子发烧友VIP会员 尊享10大特权
海量资料免费下载
精品直播免费看
优质内容免费畅学
课程9折专享价
創(chuàng)作中心

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

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

一個實用的GitHub項目:TensorFlow-Cookbook

DPVg_AI_era ? 來源:lq ? 2019-02-19 09:04 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

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

今天為大家推薦一個實用的GitHub項目:TensorFlow-Cookbook。

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

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

項目正在進行中,作者將持續(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)絡插入數(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)

了解更多,請閱讀:

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

注意

如果你不想共享變量,請以不同的方式設置所有作用域名稱。

權(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,請參考:

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

如何使用adaptive_instance_norm,請參考:

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,請參考:

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)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學習之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • 函數(shù)
    +關(guān)注

    關(guān)注

    3

    文章

    4379

    瀏覽量

    64637
  • GitHub
    +關(guān)注

    關(guān)注

    3

    文章

    483

    瀏覽量

    17606
  • tensorflow
    +關(guān)注

    關(guān)注

    13

    文章

    330

    瀏覽量

    61118

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

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

收藏 0人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關(guān)推薦
    熱點推薦

    如何使用tensorflow快速搭建起深度學習項目

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

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

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

    TensorFlow是什么

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

    TensorFlow的特點和基本的操作方式

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

    The VHDL Cookbook

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

    github入門到上傳本地項目步驟

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

    github使用教程_github菜鳥教程

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

    提出快速啟動自己的 TensorFlow 項目模板

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

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

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

    人工智能涼了? GitHub年度報告揭示真相

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

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

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

    GitHub年度報告:Python首次擊敗Java

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

    TensorFlow Community Spotlight獲獎項目

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

    上傳本地項目代碼到github

    GitHub面向開源及私有軟件項目的托管平臺,因為只支持git 作為唯的版本庫格式進行托管,故名
    的頭像 發(fā)表于 11-14 16:45 ?1343次閱讀
    上傳本地<b class='flag-5'>項目</b>代碼到<b class='flag-5'>github</b>

    如何使用Github高效率的查找項目

    GitHub各位應該都很熟悉了,全球最大的開源社區(qū),也是全球最大的同性交友網(wǎng)站~~,但是大部分同學使用GitHub應該就是通過別人的開源鏈接,點進去下載對應的項目,而真正使用Github
    的頭像 發(fā)表于 09-24 14:43 ?934次閱讀
    如何使用<b class='flag-5'>Github</b>高效率的查找<b class='flag-5'>項目</b>
    主站蜘蛛池模板: 中文字幕在线视频免费观看 | 免费高清国产 | nxgx69日本护士 | 一一本之道高清视频在线观看中文字幕 | 国产伦子沙发午休系列资源曝光 | 97人人爽人人爽人人人片AV | 挠黑色超薄丝袜脚心vk40分钟 | 樱桃bt在线www | 国产 欧美 亚洲 日韩视频 | 狠狠色狠狠色综合系列 | 野花社区视频WWW高清 | 午夜国产精品视频在线 | 暖暖视频大全免费观看 | 交换年轻夫妇HD中文字幕 | 欧美一区二区激情视频 | 同时和两老师双飞 | 仓井空torrent | 沦为公交两奶头春药高潮迭起 | 日日干夜夜啪蕉视频 | 日本高清在线一区二区三区 | 亚洲精品黄色 | 一区精品在线 | 久久亚洲精品AV成人无码 | 果冻传媒9CM在线观看 | 91九色网址 | 欧美巨大巨粗黑人性AAAAAA | 色情在线avav| 一个人在线观看免费高清视频 | 激情内射亚州一区二区三区爱妻 | 国产区精品综合在线 | 德国xxxx | 99免费在线观看 | 亚洲不卡一卡2卡三卡4卡5卡 | 精品熟女少妇AV免费观看 | 中文字幕s级优女区 | 美国色情三级欧美三级纸匠情挑 | 中国人泡妞xxxxxxxx19 | 人妻无码AV中文系列 | 99无人区码一码二码三 | FREECHINESE东北女人真爽 free18sex性自拍裸舞 | 黑丝美女娇喘 |

    電子發(fā)燒友

    中國電子工程師最喜歡的網(wǎng)站

    • 2931785位工程師會員交流學習
    • 獲取您個性化的科技前沿技術(shù)信息
    • 參加活動獲取豐厚的禮品