跑通 MobileNet in Tensorflow

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!

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值