GithubHelp home page GithubHelp logo

chunjiongzhang / tensorflow_alexnet_classify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stephen-v/tensorflow_alexnet_classify

0.0 1.0 0.0 303 KB

tensorflow_alexnet_classify (details http://www.cnblogs.com/vipyoumay/p/7686230.html)

License: Apache License 2.0

Python 100.00%

tensorflow_alexnet_classify's Introduction

tensorflow_alexnet_classify

This repository aims to implement a alexnet with tensorflow. The train file contains 25000 images (cat and dog). We built this AlexNet in Windows , it's very convenient for most of you to train the net.

Requirements

  • Python 3.5
  • TensorFlow 1.8.0
  • Numpy
  • cat and dog images here

Usage

1' Make sure that you have already changed file directory to the right format.

example:

/path/to/train/cat/cat_1.jpg

/path/to/train/cat/cat_2.jpg

/path/to/train/dog/dog_1.jpg

/path/to/train/dog/dog_2.jpg

/path/to/test/cat/cat_1.jpg

/path/to/test/dog/dog_1.jpg

2' Modify parameters of the beginning of main function in the main_alexnet.py file.

example:

learning_rate = 1e-3
num_epochs = 17  
train_batch_size = 1000 
test_batch_size = 100
dropout_rate = 0.5
num_classes = 2  
display_step = 2 

filewriter_path = "./tmp/tensorboard" 
checkpoint_path = "./tmp/checkpoints"  

image_format = 'jpg' 
file_name_of_class = ['cat',
                      'dog']
train_dataset_paths = ['G:/Lab/Data_sets/catanddog/train/cat/', 
                       'G:/Lab/Data_sets/catanddog/train/dog/'] 
test_dataset_paths = ['G:/Lab/Data_sets/catanddog/test/cat/',
                      'G:/Lab/Data_sets/catanddog/test/dog/'] 

Notes:

  • The alexnet.py and datagenerator.py files have been builded, you don't have to modify it. But if you have more concise or effective codes, please do share them with us.
  • The main_alexnet.py is aimed to tune the weights and bias in the alexnet.
  • This model is easily transfered into a multi-class classification model. All you need to do is modifying parameters of the beginning of main function in the main_alexnet.py file.

Example output:

We choosed ten pictures from the internet to validate the AlexNet, there were three being misidentified, the accuracy is about 70%, which is similar to the accuracy we tested before. But, On the whole, the AlexNet is not as good as we expected, the reason may have something to do with the datesets. If you have more than One hundred thousand dataset, the accuracy must be better than we trained. See the results below:

2017-10-18-10-16-50

2017-10-18-10-18-37

2017-10-18-10-19-57

2017-10-18-10-21-22

2017-10-18-10-23-09

2017-10-18-10-27-53

2017-10-18-10-26-36

2017-10-18-10-29-58

2017-10-18-10-33-15 2017-10-18-10-38-02

tensorflow_alexnet_classify's People

Contributors

idlesschaye avatar stephen-v avatar vickyyoumay avatar

Watchers

 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.