Skip to content

Latest commit

 

History

History
 
 

official

Logo

TensorFlow Official Models

The TensorFlow official models are a collection of models that use TensorFlow’s high-level APIs. They are intended to be well-maintained, tested, and kept up to date with the latest TensorFlow API.

They should also be reasonably optimized for fast performance while still being easy to read. These models are used as end-to-end tests, ensuring that the models run with the same or improved speed and performance with each new TensorFlow build.

More models to come!

The team is actively developing new models. In the near future, we will add:

  • State-of-the-art language understanding models.
  • State-of-the-art image classification models.
  • State-of-the-art object detection and instance segmentation models.

Table of Contents

Models and Implementations

Computer Vision

Image Classification

Model Reference (Paper)
MNIST A basic model to classify digits from the MNIST dataset
ResNet Deep Residual Learning for Image Recognition
ResNet-RS Revisiting ResNets: Improved Training and Scaling Strategies
EfficientNet EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks

Object Detection and Segmentation

Model Reference (Paper)
RetinaNet Focal Loss for Dense Object Detection
Mask R-CNN Mask R-CNN
ShapeMask ShapeMask: Learning to Segment Novel Objects by Refining Shape Priors
SpineNet SpineNet: Learning Scale-Permuted Backbone for Recognition and Localization
Cascade RCNN-RS and RetinaNet-RS Simple Training Strategies and Model Scaling for Object Detection

Natural Language Processing

Model Reference (Paper)
ALBERT (A Lite BERT) ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
BERT (Bidirectional Encoder Representations from Transformers) BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
NHNet (News Headline generation model) Generating Representative Headlines for News Stories
Transformer Attention Is All You Need
XLNet XLNet: Generalized Autoregressive Pretraining for Language Understanding
MobileBERT MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devices

Recommendation

Model Reference (Paper)
DLRM Deep Learning Recommendation Model for Personalization and Recommendation Systems
DCN v2 Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems
NCF Neural Collaborative Filtering

How to get started with the official models

Please follow the below steps before running models in this repository.

Requirements

  • The latest TensorFlow Model Garden release and TensorFlow 2
    • If you are on a version of TensorFlow earlier than 2.2, please upgrade your TensorFlow to the latest TensorFlow 2.
pip3 install tf-nightly
  • Python 3.7+

Our integration tests run with Python 3.7. Although Python 3.6 should work, we don't recommend earlier versions.

Installation

Method 1: Install the TensorFlow Model Garden pip package

tf-models-official is the stable Model Garden package. pip will install all models and dependencies automatically.

pip install tf-models-official

If you are using nlp packages, please also install tensorflow-text:

pip install tensorflow-text

Please check out our example to learn how to use a PIP package.

Note that tf-models-official may not include the latest changes in this github repo. To include latest changes, you may install tf-models-nightly, which is the nightly Model Garden package created daily automatically.

pip install tf-models-nightly

Method 2: Clone the source

  1. Clone the GitHub repository:
git clone https://github.com/tensorflow/models.git
  1. Add the top-level /models folder to the Python path.
export PYTHONPATH=$PYTHONPATH:/path/to/models

If you are using a Colab notebook, please set the Python path with os.environ.

import os
os.environ['PYTHONPATH'] += ":/path/to/models"
  1. Install other dependencies
pip3 install --user -r official/requirements.txt

Finally, if you are using nlp packages, please also install tensorflow-text-nightly:

pip3 install tensorflow-text-nightly

Contributions

If you want to contribute, please review the contribution guidelines.