Giter Club home page Giter Club logo

cnnforandroid's Introduction

CnnForAndroid:A Classification Project using Convolutional Neural Network(CNN) in Android platform。It also support Caffe Model

CnnForAndroid is an android platform's implementation of deep learning using Tiny-cnn structure and provide two Recognition sample:one is gender Recognition for caffe net ; two is Car logo recognition for tiny-cnn net.

Todo List

  • add opencl support.
  • change to the tiny-dnn new version
  • Optimise the code and improve the speed.

Dependencies

Opencv(for Android platform Opencv-2.4.9)

Tiny-cnn(old Version)

protobuf

Support Caffe model

tiny-cnn provide the caffe-convertor.cpp to support the caffe model.The project also support the caffe model from compiling the caffe_convertor and protobuf.

Gender Recognition

this project also provide a sample for caffe model to distingguish man from woman also called gender recognition.

1.Where from training data?

MORPH Album 2.

the test accuracy is 90.01% in my caffe's net.

2.the net of caffe ?

3.How to train yourself caffe's model?

(1)Please using caffe and train your model.     
(2)then replace  /assets/tinyfile//.caffemodel and /assets/tinyfile/*.protobuf file/.
(3)Finish  change those filenames in tinyCnn.java file.

How to install it?

no need install.

Just download or git clone it and then open it by eclipse with opencv for java lib ,  use NDK to build it.
Surely your libs docu have the opencv_java.so file or you must add this file(from Opencv-android docu).

APK Download

Compile it

needful tools: NDK + eclipse + adt.

or android studio.

#For Vehicle Recogniton for tiny-cnn net

1.What is Vehicle Recognition?

this project classify car according to car logo.Now the lasting Version just distinguish VM car from other.

2.Where from Training Data ?

The major sources of our dataset include images captured by ourselves,Medialab LPR Dataset [1].

3.this models?

You can get it in JNi/test.cpp file.

Code:

  static const bool tbl[] = {
			O, X, O, O, O, O, O, O, O, O, O, X, O, O, O, O,
			O, X, X, X, O, O, O, X, X, O, O, O, X, X, O, O,
			O, O, X, X, X, O, O, O, X, X, O, O, X, X, X, O,
			O, O, O, X, X, X, O, O, O, X, X, O, X, X, O, O,
			O, O, O, O, X, X, O, O, O, O, X, X, O, X, X, O,
			O, X, O, O, O, X, X, O, O, O, O, X, O, O, X, O,
	};

	 nn << convolutional_layer<tan_h>(40 , 40 , 3 , 1 , 6)  
		<< average_pooling_layer<tan_h>(38 , 38 , 6 , 2)   
		<< convolutional_layer<tan_h>(19 , 19 , 4 , 6 , 16 ,
		connection_table(tbl, 6, 16))              
		<< average_pooling_layer<tan_h>(16 , 16 , 16 , 2)  
		<< convolutional_layer<tan_h>(8 , 8 , 3 , 16, 16) 
		<< fully_connected_layer<tan_h>(16 * 6 * 6 , 64)
		<< fully_connected_layer<relu>(64 , 2);
		

My models have three conv-layers and two pooling layer , fully-connect layer , in the end layer , the activation functions is relu and the size of all conv-kernel is 3x3.The optimization algorithm of cnn is stochastic gradient levenberg marquardt.

Other arguments can't be public.

4.Experiment

data:

	 500 train image , 298 test image.

platform:

	Windows+VS2013.
Result:
	 the recognition rate is above 94.29% 

How to use it to recognize face or other object?

If want to recognition other object , you must learning Cnn and tiny-cnn , contructing optimal model and training it using enough object images to get the wb-file(weights and bias values).Finish , replace /assets/tinyfile/carlogo file with wb-file.

References

[1]Medialab LPR dataset, March. 2013[online]. Available: http://www.medialab.ntua.gr/research/LPRdataset.html

[2]Humayun Karim Sulehria, Ye Zhang.Vehicle Logo Recognition Using Mathematical Morphology

[3]Humayun Karim Sulehria, Ye Zhang.Vehicle Logo Recognition Based on Bag-of-Words.IEEE International Conference on Advanced Video and Signal Based Surveillance,2013.

Running Screenshot

(1)For Vehicle Recogniton

(3)For gender Recognition

Discussing

cnnforandroid's People

Contributors

zhangqianhui avatar

Watchers

James Cloos 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.