Tensorflow 2.0之TF-slim


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM