Machine Learning @ NCTU EE (grad) 2016 Sep. - 2017 June
In this project, you are asked to classify the input photos into
4 age groups and 2 genders. You are free to use any methods, tools,
and language to finish this work.
If you want to use any work that is not built by you, be sure to
specify it in your report. Also, just repeating other people’s work
won’t help you get high score in this subject, be sure to include
your own idea in this work.
A. Input:
The input will be an RGB photo or Gray level photo with different
size. The photos above are from the class child, young, adult, and
elder, respectively.
You are only allowed to use the photos in this dataset. (Data
augmentation is permitted) We may randomly pick some team’ s work to
retrain it to check if the result is far differed from your submission.
B. Target
For each photos, please classify it into one of the following classes.
You can predict age and gender jointly or separately, but the final
result need to be one of the classes above.
Class is defined as follows:
0: Male Child, 4: Female Child
1: Male Young, 5: Female Young
2: Male Adult, 6: Female Adult
3: Male Elder, 7: Female Elder
Daniel You, Vivian Chung
Tensorflow, Dlib, scikit-learn
Data Conversion
http://blog.csdn.net/u012759136/article/details/52232266
Tensorflow
https://www.tensorflow.org/tutorials/layers
MNIST using TensorFlow
http://terrence.logdown.com/posts/1240896-play-tensorflow-mnist-handwriting-recognition
Face Landmarks with dlib, Opencv, and Python
http://www.pyimagesearch.com/2017/04/03/facial-landmarks-dlib-opencv-python/
Dlib Intro. [Chinese]
https://chtseng.wordpress.com/2016/12/23/dlib-%E5%A5%BD%E7%94%A8%E7%9A%84%E7%9A%84machine-learning%E5%B7%A5%E5%85%B7-%E4%B8%80/
CNN example reference
http://arbu00.blogspot.tw/2017/03/2-tensorflowconvolutional-neural.html
LBP by sk-image
http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_local_binary_pattern.html
ML_Final_Project.py: Top module for the project.
data_conversion.py : Convert images to binary data for faster access for TensorFlow.
Modules.py : Modules used throughout the project.
pending_code.py : Codes that might be added to the project.
(Done) Facial Recognition
(Done) Data Augmentation
(Done) Convert to TensorFlow data type
(Done) Implementing CNN with TensorFlow
(Almost Done) Make the model usable
(In Progress) Further tuning the model (Refine the model)
(In Progress) Choice of optimizers and adaptive learning rate if valid
(Coming Soon) Other Image Processing (LBP -> HOG -> ...)
(----) Re-train the model and fine tuning
(----) Demo code preparation
(----) Report
- Trying to converge the model faster.
- Other optimizers?
- Structure of the model
#1 Load testing data as batch for validation.
#2 Unusable model (Cause UNKNOWN)
#3 Out-of-Memory... perhaps not well optimized :(
- Parameterized the model
- Reduce training time and computational resources
- Better face recognition
- Find effective data augmentation methods
- [DONE] Increase the amount of data (size of dataset = 39xxx)
- Other image processing techniques
- Demo code preparation
- Adaptive learning rate
- Choose proper optimizer
https://www.tensorflow.org/api_guides/python/train#Optimizers
Simple git commit and push at once, and add files if given.
sh routine
(required step, run the command just once when moving the file across machines)
chomod 777 routine
(execute step)
./routine
- Just update files that already exist.
Commit message: "routinely commit"
./routine
- Add one or multiple new files to the project.
Commit message: "File(s): [list_of_files] added to the project"
./routine [list_of_files]
example:
./routine file1 file2
Open Tensorboard (path adapted to our library path, change it if needed) without TensorBoard install by pip
./visualize
If TensorBoard is installed
tensorboard --logdir=/path/to/log-directory
e.g. if the log stores in log/
tensorboard --logdir=log/
Dlib
http://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/
OpenCV
http://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/
TensorFlow (build from source)
https://www.tensorflow.org/install/install_sources
Convert label to one-hot
https://agray3.github.io/2016/11/29/Demystifying-Data-Input-to-TensorFlow-for-Deep-Learning.html
label = tf.stack(tf.one_hot(label-1, nClass))
Fetch mini-batch from queue
https://stackoverflow.com/questions/41978221/tensorflow-next-batch-of-data-from-tf-train-shuffle-batch
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
threads = tf.train.start_queue_runners(sess=sess)
minibatch = sess.run([data, label])
Release GPU memory after computation
tensorflow/tensorflow#1578
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
with tf.Session() as sess:
sess = tf.Session(config=config)
Open TensorBoard on local machine from remote server
https://stackoverflow.com/questions/37987839/how-can-i-run-tensorboard-on-a-remote-server
Login the remote server using command
ssh -L local_machine_port:127.0.0.1:6006 username@remote_server
Where 127.0.0.1:6006 represents the port 6006 on remote_server, this command forwards all contents on the remote_server:6006 to your local machine.
e.g. if 16006 is the port that we want to use as local_machine_port, then
ssh -L 16006:127.0.0.1:6006 username@remote_server
To open Tensorboard, we can launch the TensorBoard on the remote server and simply accesss the port 16006 on our local machine.
127.0.0.1:16006