TensorFlow-Slim image classification model library
TF-slim is a new lightweight high-level API of TensorFlow (tensorflow.contrib.slim
) for defining, training and evaluating complex models. This directory contains code for training and evaluating several widely used Convolutional Neural Network (CNN) image classification models using TF-slim. It contains scripts that will allow you to train models from scratch or fine-tune them from pre-trained network weights. It also contains code for downloading standard image datasets, converting them to TensorFlow's native TFRecord format and reading them in using TF-Slim's data reading and queueing utilities. You can easily train any model on any of these datasets, as we demonstrate below. We've also included a jupyter notebook, which provides working examples of how to use TF-Slim for image classification. For developing or modifying your own models, see also the main TF-Slim page.
Tensorflow2.0变动之一就是弃用了tf.contrib。。
但是有时候需要在tensorflow2.0里使用slim。
那么这个问题该如何解决?
在 https://github.com/tensorflow/models/issues/8020 中
在tensorflow2.0中没有slim有什么替代方案吗?
要在TF2中以兼容的模式使用,你需要把它当作一个包来安装。
安装方式:
1. Download Zip。然后,python setup.py install
使用方法:
跟原来有一点不同
#import tensorflow as tf
import tensorflow.compat.v1 as tf
#from tensorflow.contrib.slim.nets import vgg
import tf_slim as slim