2017年3月25日 星期六

[Tensorflow] Tensorflow 中的 ALexNet VGGNet GoogleLeNet(Inception-v1) 實作

先說結論:要了解實做細節,Tensorflow官方Github有很多寶貝可以挖

使用常見的類神經網路

Tensorflow 的其實很佛心的把各種不同常用的的神經網路實做出來

包含時常作為Benchmark的 AlexNet、VGGNet、GoogleLeNet(Inception-v1)、ResNet等

VGGNet 使用教學範例

在這篇教學文 TF-Slim Walkthrough 中

教我們如何使用 Tensorflow 中的VGGNet 來作為影像分類器

另一個VGGNet範例: Working example: Tracking Multiple Metrics


如果需要哪個類神經網絡架構,可以把它預先訓練好的參數 (ckpt) 檔拿來使用

其他預先訓練的參數檔案 在此

ps. 連2016最新的類神經網路架構 Inception-ResNet-v2 也有

如果有需要使用test dataset Downloading and converting to TFRecord format 教我們怎下載與轉成 tfrecords 檔

TF slim Module

如官方的Blog

TF-Slim: A high level library to define complex models in TensorFlow

文中所說的,TF slim 是一個用來定義模型的輕量化函式庫(Libraries)
The Inception-V3 model was built on an experimental TensorFlow library called TF-Slim, a lightweight package for defining, training and evaluating models in TensorFlow
而本文的重點在此
Code to define and train many widely used image classification models (e.g., Inception[1][2][3], VGG[4], AlexNet[5], ResNet[6]). 
此外
Since that release, TF-Slim has grown substantially, with many types of layersloss functions, and evaluation metrics added, along with handy routines for training and evaluating models. These routines take care of all the details you need to worry about when working at scale, such as reading data in parallel, deploying models on multiple machines, and more. 
從文中就可以發現,Google 已經將實做的部份幫我們完成了!

所以往後如果要測試不同的神經網絡架構,只需要Tensorflow 的 TF slim 裡面叫出來使用即可


源始碼

先從 Tensorflow 的其中一個專門存放 models 的 repository 來看,進入到 inception 的資料夾

打開 imagenet_train.py 的源始碼中可以看到,它使用的是 inception 這種類神經網路架構

而在 inception 模組中的 inception_train.py 中可以看到它有使用到 TF slim 模組

from inception.slim import slim


練習實作

當然,閱讀了這多文獻、文章,還是需要大家自己親手實做一個神經網落是最有感覺的

Tensorflow 官網的這篇教學文章


提供我們一個手把手的教學,幫助我們了解怎從零打造一個 CNN 類神經網路



沒有留言:

張貼留言

/* 載入prettify的autoloader */ /* 載入JQuery */