Code Monkey home page Code Monkey logo

imagerecognition's Introduction

Image Recognition

Dependency: numpy, matplotlib, Tensorflow, cv2(For visualization)

A Stand-alone version for ImageRecognition project here

  • Inception-v3 model for this project can be downloaded here
  • Extract the zipped file and put Inception-v3 model (which should be renamed from 'tensorflow_inception_graph.pb' to 'Model.pb') to 'Models/Extractor/v3' folder
  • Put your training set FOLDERS into '_Data' folder, please use English names for your folders to ensure that cv2 works correctly
    • Each folder name should be treated as the 'label' of the pictures contained in the folder
  • Put your test set PICTURES into 'Test' folder
    • If possible, provide a ONE-HOT answer naming '_answer.npy' into 'Test' folder as well for better visualization
    • If you don't want to struggling for these, just leave 'Test' folder empty (Reference the Notice below)
  • Run 'Main.py'!

Notice That:

  • If 'Test' folder remains empty when the program is running, min(196, 0.2 * n_data)pictures will be MOVED from '_Data' folder to 'Test' folder if 'gen_test' FLAG is True
    • An '_answer.npy' ndarray will also be generated automatically!
  • After processing all images in '_Data' folder, a '_Cache' folder which contains 'features.npy' and 'labels.npy' (shuffled) will be generated
    • If you want to train on new dataset, '_Cache' folder should be deleted
    • You can train your own classifier using 'features.npy' and 'labels.npy'
  • After the program is done, a Predictor will be stored in 'Models/Predictors/v3' folder. If you want to train on new dataset, this folder should be deleted

--args:

parser.add_argument(

"--gen_test",
type=bool,
default=True,
help="Whether generate test images"

)

parser.add_argument(

"--images_dir",
type=str,
default="Test",
help="Path to test set"

)

parser.add_argument(

"--extract_only",
type=bool,
default=False,
help="Whether extract features only"

)

parser.add_argument(

"--visualize_only",
type=bool,
default=False,
help="Whether visualize only"

)

parser.add_argument(

"--overview",
type=bool,
default=True,
help="Whether use cv2 to overview"

)

Visualization

image

image

(Not so elegant, but (maybe) better than nothing...)

imagerecognition's People

Contributors

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