GithubHelp home page GithubHelp logo

tensorflow-vgg-1's Introduction

Tensorflow VGG

This is a Tensorflow implemention of VGG forked from tensorflow-vgg repo.

The main change from the original repo are:

  • The Vgg class won't load the VGG model in the constructor so that you are allowed to share the model among multiple Vgg instances.
  • The Vgg class is now able to do training and prediction and you could shared a model among multiple Vgg instance. That makes you more flexible to design the algorithm infrastructure.

To use the VGG networks, you should download the *.npy files from VGG16 or VGG19 and put them under the models directory.

Usage

It is still under development, please stay tuned. This is a rough example for the prediction.

###Use It for Predicting

First, load the model (around 500MB) to the memory.

model = np.load("/path/to/your/vgg19.npy").item()
print("The VGG model is loaded.")

New the Vgg19 instance in the scope of your tf.Graph. Run the graph in a tf.Session.

# Design the graph.
graph = tf.Graph()
with graph.as_default():
    nn = Vgg19(model=model)

# Run the graph in the session.
with tf.Session(graph=graph) as sess:
    tf.initialize_all_variables().run()
    print("Tensorflow initialized all variables.")

    preds = sess.run(nn.preds,
                     feed_dict={
                         nn.inputRGB: imgs
                     })

You could also add a tf.train.SummaryWriter to summarize whatever you want. Then enter the command, tensorboard --log=/path/to/your/log/dir, to see the summary in the web page.

# Run the graph in the session.
with tf.Session(graph=graph) as sess:
    tf.initialize_all_variables().run()
    print("Tensorflow initialized all variables.")

    # The OP to write logs to Tensorboard.
    summary_writer = tf.train.SummaryWriter("/path/to/your/log/dir",
                                            graph=sess.graph)

    preds = sess.run(nn.preds,
                     feed_dict={
                         nn.inputRGB: imgs
                     })

tensorflow-vgg-1's People

Contributors

tcw165 avatar

Watchers

shiontao 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.