tensorflow 迁移学习(在已有类别的模型上添加自己的类别)
来源:互联网 发布:log4j保存到数据库 编辑:程序博客网 时间:2024/09/21 09:03
要添加并训练自己的类别,最关键的还是 源码文件夹下/tensorflow/tensorflow/examples/image_retraining
的retain.py文件,其实文件一开始已经写的很清楚了,我怕忘了,在此记录一下,请看retain.py的这部分
Here's an example, which assumes you have a folder containing class-named
subfolders, each full of images for each label. The example folder flower_photos
should have a structure like this:
~/flower_photos/daisy/photo1.jpg
~/flower_photos/daisy/photo2.jpg
...
~/flower_photos/rose/anotherphoto77.jpg
...
~/flower_photos/sunflower/somepicture.jpg
以上告诉你自己数据的文件结构
这部分
python tensorflow/examples/image_retraining/retrain.py \
--image_dir ~/flower_photos
```
You can replace the image_dir argument with any folder containing subfolders of
images. The label for each image is taken from the name of the subfolder it's
in.
This produces a new model file that can be loaded and run by any TensorFlow
program, for example the label_image sample code.
By default this script will use the high accuracy, but comparatively large and
slow Inception v3 model architecture. It's recommended that you start with this
to validate that you have gathered good training data, but if you want to deploy
on resource-limited platforms, you can try the `--architecture` flag with a
Mobilenet model. For example:
```bash
python tensorflow/examples/image_retraining/retrain.py \
--image_dir ~/flower_photos --architecture mobilenet_1.0_224
There are 32 different Mobilenet models to choose from, with a variety of file
size and latency options. The first number can be '1.0', '0.75', '0.50', or
'0.25' to control the size, and the second controls the input image size, either
'224', '192', '160', or '128', with smaller sizes running faster. See
https://research.googleblog.com/2017/06/mobilenets-open-source-models-for.html
for more information on Mobilenet.
这部分告诉你:
1.把图像数据准备好后的运行指令,其中--image_dir 可以是相对路径也可以是绝对路径,只要对就行,不然报错找不到图像
2.--architecture 这个参数是你要训练的模型类型,比如例子是在移动Mobilenet_1.0_224,具体有多少种类型可以看函数create_model_info,里面有两种现成模型,一种是inception_v3 还有一种是用于手机移动端的mobilenet_,这个类型下面又有很多不同组合,具体自己看说明
最后多一嘴,在代码的第151左右有一句extensions = ['jpg', 'jpeg', 'JPG', 'JPEG']告诉你自己的图片格式要求其他格式会报错,当然你添加一下就可以,但不知道结果会不会是想的那样
- tensorflow 迁移学习(在已有类别的模型上添加自己的类别)
- 双击框添加对已选类别的判断
- 类别的作用,集成和类别在实现中有什么区别,类别和扩展的区别
- 类别的作用?继承和类别在实现中有何区别?
- 类别的作用?继承和类别在实现中有何区别?
- OSG 模型添加(含自己画的模型,已有模型),对添加的模型做平移 缩放等。
- 在Windows7上通过Dao安装Tensorflow-(综合已有资料和自己调试经验的总结)
- 虚幻4创建自己的UMG类别
- 有类别IP地址的程序分析
- 类别(Category)的作用(三)---添加非正式协议
- 类别添加UIImage的裁剪方法
- 类别 的使用实例(NSString的类别增加方法)
- linux上包的平台Arch类别
- caffe用自己的数据训练模型,并测试输出图片类别
- iOS 在类别中犯的错误
- 取类别区分的TOP10(学习备注)
- 取类别区分的TOP10 by Access(学习备注)
- c++学习之变量的存储类别
- AIDL的使用
- HashMap和HashTable以及HashSet
- UVA 1476 Error Curves
- js转换成会计字符并逗号隔开保留两位小数,整数后面加.00
- 创建线程的方法
- tensorflow 迁移学习(在已有类别的模型上添加自己的类别)
- react Redux思路
- iOS唯一标示符引导
- 聚类系列
- 【LeetCode】Intersection of Two Linked Lists 解题报告
- Q138:PBRT-V3,伪随机数发生器(pseudo-random number generator,RNG)(A.1.2章节)
- pycharm激活码 用服务器激活方法
- 170827 逆向-PE文件基本格式
- 深度解析树操作