MobileNet:
MobileNet是由Google的研究者们设计的一类卷积神经网络。它们在手机上运行,计算消耗小、运行速度快,因此很适合在移动端上做应用。
跑通MobileNet:
已经集成进TensorFlow之中
https://github.com/tensorflow/tensorflow
步骤:
1.git clone https://github.com/tensorflow/tensorflow.git
2.prepare dataset
format like:
data/man
data/woman
3.use something pretrain to fit our datasrt
retrain :
sudo python tensorflow/examples/image_retraining/retrain.py –image_dir /Users/vickers.zhu/Git/MobileNet/data/ -—architecture mobilenet_0.25_128_quantized
this step may download a model file : inception-2015-12-05.tgz
but it’s always fail to download it
so i copy one from other place
run again:
sudo python tensorflow/examples/image_retraining/retrain.py –image_dir /Users/vickers.zhu/Git/MobileNet/data/ -—architecture mobilenet_0.25_128_quantized
-—architecture mobilenet_0.25_128_quantized means mobilenet
if you want to use inception just change it
final accuracy is about 0.9 (nothing, we can change our training data)
4.run classification program:
sudo python tensorflow/examples/label_image/label_image.py –graph=/tmp/output_graph.pb –labels=/tmp/output_labels.txt –image=/Users/vickers.zhu/Git/facenet/image/image/1/88-FaceId-0.jpg
here is a bug
“The name ‘import/input’ refers to an Operation not in the graph.”
open label_image.py
change line78 ane line 79 to
input_layer = “Mul”
output_layer = “final_result”
run again:
sudo python tensorflow/examples/label_image/label_image.py –graph=/tmp/output_graph.pb –labels=/tmp/output_labels.txt –image=/Users/vickers.zhu/Git/facenet/image/image/1/88-FaceId-0.jpg
we got:
man 0.818951
notman 0.181049
nice!