使用TensorFlow识别照片中的物体
2024-10-15 11:52:02
1.环境ubuntu14.04.5
安装TensorFlow
官方文档:https://www.tensorflow.org/install/install_linux
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp27-none-linux_x86_64.whl
注意:后面的网址根据不同设置而不同:
Python 2.7 CPU only: https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp27-none-linux_x86_64.whl
GPU support: https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp27-none-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in NVIDIA requirements to run TensorFlow with GPU support. Python 3.4 CPU only: https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp34-cp34m-linux_x86_64.whl
GPU support: https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp34-cp34m-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in NVIDIA requirements to run TensorFlow with GPU support. Python 3.5 CPU only: https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp35-cp35m-linux_x86_64.whl
GPU support: https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp35-cp35m-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in NVIDIA requirements to run TensorFlow with GPU support. Python 3.6 CPU only: https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp36-cp36m-linux_x86_64.whl
GPU support: https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp36-cp36m-linux_x86_64.whl
我选择了相当于:python2.7 纯CPU
自动安装无误,若有安装失败,可能是网络问题,重新执行一遍试试。
也有可能是若干依赖没有装好:先把 各种依赖都安一遍
下载神经网络模型:http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz
mkdir model
tar -xf archive_name.tar -C model/
下载代码:https://codeload.github.com/tensorflow/models/zip/master
unzip models-master.zip
cd models-master/tutorials/image/imagenet/
其中的classify_image.py是我们实现物体识别的主代码
接下来做几个测试
classify_image.py --model_dir /home/usr/model --image_file /home/usr/model/cropped_panda.jpg
classify_image.py --model_dir /home/usr/model --image_file /home/usr/model/testkb.jpg
classify_image.py --model_dir /home/usr/model --image_file /home/usr/model/testmous.jpg
giant panda, panda, panda bear, coon bear, ailuropoda melanoleuca (score = 0.89107)
computer keyboard, keypad (score = 0.64016)
mouse, computer mouse(score = 0.89453)
最新文章
- DOMO1
- scrollview 图片放大 捏合 瓦片地图 相关注意事项
- oc程序代码
- Linux搭建FTP
- String,StringBuffer,StringBuilder的区别及其源码分析
- RabbitMQ基础入门
- Chipmunk僵尸物理对象的出现和解决(七)
- Ajax的初步认识
- [matlab] 1.拟合
- 2017-12-22 日语编程语言";抚子";-第三版实现初探
- C#编程(七十九)---------- 反射
- php 把秒数转换为时长(h:i:s格式)
- ios实例开发精品文章推荐(8.13)
- C# 两个时间相减 返回 对应天时分秒
- 7 -- Spring的基本用法 -- 6... Spring 3.0 提供的Java配置管理
- 在mvc4中上传、导入和导出excel表方法总结
- Opencv读取图片像素值
- [算法] 将单链表的每K个节点之间逆序
- Django进阶Template篇002 - 模板包含和继承
- 14-jQuery的ajax