linux 运行 AI模型

代码源

https://github.com/dpressel/rude-carnie

跑这个例子如果是英文不熟,可以异步中文版,有测试图片

https://github.com/nanpian/rude-carnie

模型下载

You can find a pre-trained age checkpoint for inception here:https://drive.google.com/drive/folders/0B8N1oYmGLVGWbDZ4Y21GLWxtV1E 因为被墙,在这提供百度网盘下载链接,下载后解压到本地工程里面的22801目录 http://pan.baidu.com/s/1mhLBIHy

运行步骤

python2.7 guess.py --model_type inception --model_dir ./22801 --filename test1.jpg

test1.jpg是拍的人像数据 需要安装python2.7、openCV3.0、tensorFlow1.0环境。 Ubuntu环境为14.04LTS 如果没有安装openCV环境,则会出现以下问题:

  Traceback (most recent call last):
      File "guess.py", line 12, in <module>
      from utils import ImageCoder, make_batch, FaceDetector
      File "/home/david/work/tensorflow/rude-carnie/utils.py", line 7, in <module>
      import cv2
      ImportError: No module named cv2

安装openCV

下载地址https://codeload.github.com/Itseez/opencv/zip/3.0.0 主要安装步骤参考http://www.cnblogs.com/asmer-stone/p/4592421.html

wget https://codeload.github.com/Itseez/opencv/zip/3.0.0

unzip opencv3.0.0

yum -y update

yum search vim

yum groupinstall "Development Tools"
1 sudo apt-get install build-essential
2 sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
3 sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

运行结果

~/work/tensorflow/rude-carnie$ python2.7 guess.py --model_type inception --model_dir ./22801 --filename   test1.jpg 
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Executing on /cpu:0
selected (fine-tuning) inception model
./22801/checkpoint-14999
Running file test1.jpg
Running multi-cropped image
Guess @ 1 (4, 6), prob = 0.99
Guess @ 2 (8, 12), prob = 0.01

--------------------- 本文来自 nanjingdreamfly 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/nanjingdreamfly/article/details/60141087?utm_source=copy

 

安装tensorflow

 sudo apt-get update

 sudo apt-get install python2.7-dev

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py   # 下载安装脚本
$ sudo python get-pip.py    # 运行安装脚本

sudo pip install numpy

 

pip2.7 install tensorflow==1.0.0

安装tensorflow失败:

Installing collected packages: numpy, protobuf, tensorflow
  Found existing installation: numpy 1.8.2
Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.


--apt remove python-numpy

 

Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine

---解决方法:

sudo pip install six --upgrade --ignore-installed six

2、上传本地文件到服务器
scp /path/filename username@servername:/path   

例如scp /var/www/test.php root@192.168.0.101:/var/www/  #把本机/var/www/目录下的test.php文件上传到192.168.0.101这台服务器上的/var/www/目录中

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值