TensorFlow使用记录 (十): Pretraining
上一篇的模型保存和恢复熟练后,我们就可以大量使用 pretrain model 来训练任务了
Tweaking, Dropping, or Replacing the Upper Layers
The output layer of the original model should usually be replaced since it is most likely not useful at all for the new task, and it may not even have the right number of outputs for the new task.
Similarly, the upper hidden layers of the original model are less likely to be as useful as the lower layers, since the high-level features that are most useful for the new task may differ significantly from the ones that were most useful for the original task. You want to find the right number of layers to reuse.
Try freezing all the copied layers first, then train your model and see how it performs. Then try unfreezing one or two of the top hidden layers to let backpropagation tweak them and see if performance improves. The more training data you have, the more layers you can unfreeze.
If you still cannot get good performance, and you have little training data, try dropping the top hidden layer(s) and freeze all remaining hidden layers again. You can iterate until you find the right number of layers to reuse. If you have plenty of training data, you may try replacing the top hidden layers instead of dropping them, and even add more hidden layers.
Model Zoos
Where can you find a neural network trained for a task similar to the one you want to tackle? The first place to look is obviously in your own catalog of models. This is one good reason to save all your models and organize them so you can retrieve them later easily. Another option is to search in a model zoo. Many people train Machine Learning models for various tasks and kindly release their pretrained models to the public.
TensorFlow has its own model zoo available at https://github.com/tensorflow/models. In particular, it contains most of the state-of-the-art image classification nets such as VGG, Inception, and ResNet (see Chapter 13, and check out the models/slim directory), including the code, the pretrained models, and tools to download popular image datasets.
Another popular model zoo is Caffe’s Model Zoo. It also contains many computer vision models (e.g., LeNet, AlexNet, ZFNet, GoogLeNet, VGGNet, inception) trained on various datasets (e.g., ImageNet, Places Database, CIFAR10, etc.). Saumitro Dasgupta wrote a converter, which is available at https://github.com/ethereon/caffe-tensorflow.
TensorFlow使用记录 (十): Pretraining的更多相关文章
- TensorFlow使用记录 (十四): Multi-task to MNIST + Fashion MNIST
前言 后面工作中有个较重要的 task 是将 YOLOV3 目标检测和 LanNet 车道线检测和到一个网络中训练,特别的是,这两部分数据来自于不同的数据源.这和我之前在 caffe 环境下训练检测整 ...
- TensorFlow使用记录 (十二): ℓ1 and ℓ2 Regularization
实现方式 以 ℓ2 Regularization 为例,主要有两种实现方式 1. 手动累加 with tf.name_scope('loss'): loss = tf.losses.softmax_c ...
- TensorFlow使用记录 (六): 优化器
0. tf.train.Optimizer tensorflow 里提供了丰富的优化器,这些优化器都继承与 Optimizer 这个类.class Optimizer 有一些方法,这里简单介绍下: 0 ...
- Tensorflow安装记录
一.安装Ubantu环境 下载ios 网址:http://cn.ubuntu.com/download/ 2.配合虚拟机进行安装环境 虚拟机直接百度下载即可 虚拟机采用 具体安装,虚拟机百度中很多记录 ...
- linux 配置tensorflow 全过程记录
前几天刚下一个deepin系统,是基于linux 内核的,界面的设计有些mac的feel 感觉还是挺不错的,之后就赶紧配置了一下tensorflow ,尽管之前配置过,但是这次还是遇到点儿问题,所以说 ...
- Spring学习记录(十四)---JDBC基本操作
先看一些定义: 在Spring JDBC模块中,所有的类可以被分到四个单独的包:1.core即核心包,它包含了JDBC的核心功能.此包内有很多重要的类,包括:JdbcTemplate类.SimpleJ ...
- TensorFlow学习记录(一)
windows下的安装: 首先访问https://storage.googleapis.com/tensorflow/ 找到对应操作系统下,对应python版本,对应python位数的whl,下载. ...
- windows10下TensorFlow安装记录
1.安装anaconda 安装最新版:https://repo.anaconda.com/archive/Anaconda3-5.3.0-Windows-x86_64.exe 加入环境变量: path ...
- tensorflow简单记录summary方法
虽然tf官方希望用户把 train , val 程序分开写,但实际开发中,明显写在一起比较简单舒服,但在保存数据到 summary 时, val 部分和 train 部分不太一样,会有一些问题,下面讨 ...
随机推荐
- 计算广告CTR预估系列(七)--Facebook经典模型LR+GBDT理论与实践
计算广告CTR预估系列(七)--Facebook经典模型LR+GBDT理论与实践 2018年06月13日 16:38:11 轻春 阅读数 6004更多 分类专栏: 机器学习 机器学习荐货情报局 版 ...
- Presto基础知识
背景 MapReduce不能满足大数据快速实时adhoc查询计算的性能要求. Facebook的数据仓库存储在少量大型Hadoop/HDFS集群.Hive是Facebook在几年前专为Hadoop打造 ...
- 如何使用Jedis操作redis
public class JredisTest { private static Jedis jedis = new Jedis("localhost", 6379); publi ...
- vue.js项目开发实战笔记001——准备工作
1,Vue.js 是一套构建用户界面的渐进式框架. 2,Vue.js 是由尤雨溪开发出的,最早发布于2014年2月. 3,引用vue.js地址一CDN: <script src="ht ...
- Windows命令行命令总结
转载地址:https://www.cnblogs.com/accumulater/p/7110811.html 1. gpedit.msc-----组策略 2. sndrec32-------录音 ...
- BAT面试笔试33题:JavaList、Java Map等经典面试题!答案汇总!
JavaList面试题汇总 1.List集合:ArrayList.LinkedList.Vector等. 2.Vector是List接口下线程安全的集合. 3.List是有序的. 4.ArrayLis ...
- ceres for Android 太慢的解决方法
跨平台编译了ceres,结果在android平台上运行的太慢,优化一次要0.3秒左右,时不时要一两秒.这太扯了.没辙了,在google上瞎搜索,看到 Jacobian evaluation is ve ...
- Linux中/etc/inittab文件
1. inittab基本概念 a) init进程: Linux在完成核内引导(内核镜像已被载入内存,开始运行,并已初始化所有的设备驱动程序和数据结构等)之后,接着通过启动一个用户级程序init来启动其 ...
- Oracle 触发器学习笔记一
触发器名:触发器对象的名称.由于触发器是数据库自动执行的,因此该名称只是一个名称,没有实质的用途.触发时间:指明触发器何时执行,该值可取:before:表示在数据库动作之前触发器执行;after:表示 ...
- NTP时间同步服务和DNS服务
NTP服务是搭建集群的第一步,是保持时间的同步性,保持一致 服务端 首先下载 yum install ntp –y 而后打开配置文件 /etc/ntp.conf 配置文件里有很多内容,但只要留三行就足 ...