Tensorflow 之finetune微调模型方法&&不同层上设置不同的学习率
ConvNets:
AlexNet finetune:
- 自己搭建的网络,加载初始化模型:
def load_with_skip(data_path, session, skip_layer): data_dict = np.load(data_path).item() for key in data_dict: if key not in skip_layer: with tf.variable_scope(key, reuse=True): for subkey, data in zip(('weights', 'biases'), data_dict[key]): session.run(tf.get_variable(subkey).assign(data)) print('Load pre-trained model: {}'.format(weight_file)) load_with_skip(weight_file, sess, ['fc8']) # Skip weights from fc8
- https://github.com/joelthchao/tensorflow-finetune-flickr-style
- https://github.com/kratzert/finetune_alexnet_with_tensorflow
VGG模型finetune:
- 自定义网络;加载参数,很详细教程:
- Tensorflow学习笔记:CNN篇(9)——Finetuning,复用在ImageNet已训练好的VGGNet进行图像识别
- Tensorflow学习笔记:CNN篇(10)——Finetuning,猫狗大战,VGGNet的重新针对训练
- https://www.cs.toronto.edu/~frossard/post/vgg16/
- 另外:这是个基于tensorflow-vgg16和Caffe to TensorFlow的VGG16和VGG19的一个TensorFlow的实现。
ResNet的slim模型finetune:
C/C++基本语法学习
STL
C++ primer