项目作者: KleinYuan

项目描述 :
Implementation on tensorflow fine tuning of generic CNN based model
高级语言: Python
项目地址: git://github.com/KleinYuan/tf-ft.git
创建时间: 2017-10-07T00:24:09Z
项目社区:https://github.com/KleinYuan/tf-ft

开源协议:MIT License

下载


Intro

A project for generic fine-tuning/extending
(freeze CNN layers and connect with your own customzied FC layers)
pre-trained/existing models, such as AlexNet, VGG-16, … (More CNN based).

Manual

Step1. Put your datasets somewhere and train.csv under /data/alexnet_finetune

Step2. train.csv should be the format with first column to be the locations of images (I put an example in the folder)

Step3. Run:

  1. # Download Pre-trained model
  2. bash setup.sh
  3. export PYTHONPATH='.'
  4. # You can also take advantages of the Makefile, which actually inspires me dockerize this project if I have time
  5. python apps/finetune_alexnet_train.py

Keys

One dependencies we live on is the pre-trained weights from BVLC.
That said you don’t wanna mess up with the name scope of those layers you wanna freeze. So be careful.
How we load the weights (/services/weights_load_services) should provide you enough information.

You are free to add as many layers as you like and just be aware that conv1 ~ conv5 and fc6~fc8 are those layers (as well as the NAME) you can load a pre-trained weights.

I try very hard to implement what I thought is the best practice for tensorflow — separate:

  • [X] architecture model (models/alexnet.py)

  • [X] computation model (models/finetune_graph.py)

  • [X] trainer model (models/train.py)

  • [X] training app (apps/finetune_alexnet_train.py)

so that you can independently change any part of those without impacting other components.

A better example will be my anther repo — generic CNN in tensorflow, which may have a better idea of what I am trying to do.
Since for this project, you need to sacrifice some graceful implementation due to the constraints of the pre-trained weights organization.

references

  1. AlexNet Paper
  2. Fine Tuning AlexNet on Tensorflow Example
  3. AlexNet Explainations in details