Coder Social home page Coder Social logo

kleinyuan / tf-ft Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 106 KB

Implementation on tensorflow fine tuning of generic CNN based model

License: MIT License

Python 99.05% Shell 0.63% Makefile 0.32%
tensorflow fine-tuning-cnns fine-tuning alexnet vgg convolutional-neural-networks

tf-ft's Introduction

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:

# Download Pre-trained model
bash setup.sh

export PYTHONPATH='.'

# You can also take advantages of the Makefile, which actually inspires me dockerize this project if I have time
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:

  • architecture model (models/alexnet.py)

  • computation model (models/finetune_graph.py)

  • trainer model (models/train.py)

  • 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

tf-ft's People

Contributors

kleinyuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.