README.md 7.52 KB
Newer Older
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
1
![Logo](https://storage.googleapis.com/model_garden_artifacts/TF_Model_Garden.png)
2

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
3
# TensorFlow Official Models
4

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
5
6
7
8
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.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
9

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
10
11
12
13
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.
14

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
15
## More models to come!
16

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
17
18
19
The team is actively developing new models.
In the near future, we will add:

20
21
* State-of-the-art language understanding models.
* State-of-the-art image classification models.
bhack's avatar
bhack committed
22
* State-of-the-art object detection and instance segmentation models.
23
* State-of-the-art video classification models.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
24
25

## Table of Contents
26

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
27
28
29
30
- [Models and Implementations](#models-and-implementations)
  * [Computer Vision](#computer-vision)
    + [Image Classification](#image-classification)
    + [Object Detection and Segmentation](#object-detection-and-segmentation)
31
    + [Video Classification](#video-classification)
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
32
33
34
35
36
  * [Natural Language Processing](#natural-language-processing)
  * [Recommendation](#recommendation)
- [How to get started with the official models](#how-to-get-started-with-the-official-models)

## Models and Implementations
Hongkun Yu's avatar
Hongkun Yu committed
37

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
38
### Computer Vision
Hongkun Yu's avatar
Hongkun Yu committed
39

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
40
41
42
43
44
#### Image Classification

| Model | Reference (Paper) |
|-------|-------------------|
| [MNIST](vision/image_classification) | A basic model to classify digits from the [MNIST dataset](http://yann.lecun.com/exdb/mnist/) |
45
| [ResNet](vision/beta/MODEL_GARDEN.md) | [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) |
46
| [ResNet-RS](vision/beta/MODEL_GARDEN.md) | [Revisiting ResNets: Improved Training and Scaling Strategies](https://arxiv.org/abs/2103.07579) |
47
| [EfficientNet](vision/image_classification) | [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks](https://arxiv.org/abs/1905.11946) |
Xianzhi Du's avatar
Xianzhi Du committed
48
| [Vision Transformer](vision/beta/MODEL_GARDEN.md) | [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) |
49

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
50
#### Object Detection and Segmentation
51

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
52
53
| Model | Reference (Paper) |
|-------|-------------------|
54
55
| [RetinaNet](vision/beta/MODEL_GARDEN.md) | [Focal Loss for Dense Object Detection](https://arxiv.org/abs/1708.02002) |
| [Mask R-CNN](vision/beta/MODEL_GARDEN.md) | [Mask R-CNN](https://arxiv.org/abs/1703.06870) |
56
| [ShapeMask](vision/detection) | [ShapeMask: Learning to Segment Novel Objects by Refining Shape Priors](https://arxiv.org/abs/1904.03239) |
57
| [SpineNet](vision/beta/MODEL_GARDEN.md) | [SpineNet: Learning Scale-Permuted Backbone for Recognition and Localization](https://arxiv.org/abs/1912.05027) |
Xianzhi Du's avatar
Xianzhi Du committed
58
| [Cascade RCNN-RS and RetinaNet-RS](vision/beta/MODEL_GARDEN.md) | [Simple Training Strategies and Model Scaling for Object Detection](https://arxiv.org/abs/2107.00057)|
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
59

60
61
62
63
64
65
#### Video Classification

| Model | Reference (Paper) |
|-------|-------------------|
| [Mobile Video Networks (MoViNets)](projects/movinet) | [MoViNets: Mobile Video Networks for Efficient Video Recognition](https://arxiv.org/abs/2103.11511) |

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
66
### Natural Language Processing
67

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
68
69
| Model | Reference (Paper) |
|-------|-------------------|
70
71
| [ALBERT (A Lite BERT)](nlp/MODEL_GARDEN.md#available-model-configs) | [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942) |
| [BERT (Bidirectional Encoder Representations from Transformers)](nlp/MODEL_GARDEN.md#available-model-configs) | [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805) |
Yuexin Wu's avatar
Yuexin Wu committed
72
| [NHNet (News Headline generation model)](projects/nhnet) | [Generating Representative Headlines for News Stories](https://arxiv.org/abs/2001.09386) |
73
| [Transformer](nlp/MODEL_GARDEN.md#available-model-configs) | [Attention Is All You Need](https://arxiv.org/abs/1706.03762) |
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
74
| [XLNet](nlp/xlnet) | [XLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) |
75
| [MobileBERT](projects/mobilebert) | [MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devices](https://arxiv.org/abs/2004.02984) |
76

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
77
78
### Recommendation

79
80
81
82
83
Model                            | Reference (Paper)
-------------------------------- | -----------------
[DLRM](recommendation/ranking)   | [Deep Learning Recommendation Model for Personalization and Recommendation Systems](https://arxiv.org/abs/1906.00091)
[DCN v2](recommendation/ranking) | [Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems](https://arxiv.org/abs/2008.13535)
[NCF](recommendation)            | [Neural Collaborative Filtering](https://arxiv.org/abs/1708.05031)
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
84
85

## How to get started with the official models
Hongkun Yu's avatar
Hongkun Yu committed
86

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
87
88
89
90
91
92
93
94
* The models in the master branch are developed using TensorFlow 2,
and they target the TensorFlow [nightly binaries](https://github.com/tensorflow/tensorflow#installation)
built from the
[master branch of TensorFlow](https://github.com/tensorflow/tensorflow/tree/master).
* The stable versions targeting releases of TensorFlow are available
as tagged branches or [downloadable releases](https://github.com/tensorflow/models/releases).
* Model repository version numbers match the target TensorFlow release,
such that
Hongkun Yu's avatar
Hongkun Yu committed
95
[release v2.5.0](https://github.com/tensorflow/models/releases/tag/v2.5.0)
Vishnuvardhan Janapati's avatar
Vishnuvardhan Janapati committed
96
is compatible with
Hongkun Yu's avatar
Hongkun Yu committed
97
[TensorFlow v2.5.0](https://github.com/tensorflow/tensorflow/releases/tag/v2.5.0).
Hongkun Yu's avatar
Hongkun Yu committed
98

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
99
Please follow the below steps before running models in this repository.
100

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
101
### Requirements
102

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
103
* The latest TensorFlow Model Garden release and TensorFlow 2
Hongkun Yu's avatar
Hongkun Yu committed
104
  * If you are on a version of TensorFlow earlier than 2.2, please
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
105
upgrade your TensorFlow to [the latest TensorFlow 2](https://www.tensorflow.org/install/).
Hongkun Yu's avatar
Hongkun Yu committed
106

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
107
108
109
```shell
pip3 install tf-nightly
```
Hongkun Yu's avatar
Hongkun Yu committed
110

Hongkun Yu's avatar
Hongkun Yu committed
111
112
113
114
115
* Python 3.7+

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

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
116
### Installation
Hongkun Yu's avatar
Hongkun Yu committed
117

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
118
#### Method 1: Install the TensorFlow Model Garden pip package
Hongkun Yu's avatar
Hongkun Yu committed
119

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

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
123
```shell
124
pip install tf-models-official
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
125
```
126

Chen Chen's avatar
Chen Chen committed
127
128
129
130
131
132
If you are using nlp packages, please also install **tensorflow-text**:

```shell
pip install tensorflow-text
```

133
Please check out our [example](https://github.com/tensorflow/text/blob/master/docs/tutorials/fine_tune_bert.ipynb)
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
134
to learn how to use a PIP package.
135

136
137
138
139
140
141
142
143
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.

```shell
pip install tf-models-nightly
```

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
144
#### Method 2: Clone the source
145

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
146
1. Clone the GitHub repository:
147

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
148
149
150
```shell
git clone https://github.com/tensorflow/models.git
```
151

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
152
2. Add the top-level ***/models*** folder to the Python path.
153

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
154
155
156
```shell
export PYTHONPATH=$PYTHONPATH:/path/to/models
```
157

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
158
If you are using a Colab notebook, please set the Python path with os.environ.
159

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
160
161
162
163
```python
import os
os.environ['PYTHONPATH'] += ":/path/to/models"
```
164

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
165
3. Install other dependencies
166

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
167
168
169
```shell
pip3 install --user -r official/requirements.txt
```
Hongkun Yu's avatar
Hongkun Yu committed
170

Chen Chen's avatar
Chen Chen committed
171
172
173
174
175
176
177
Finally, if you are using nlp packages, please also install
**tensorflow-text-nightly**:

```shell
pip3 install tensorflow-text-nightly
```

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
178
## Contributions
179

A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
180
If you want to contribute, please review the [contribution guidelines](https://github.com/tensorflow/models/wiki/How-to-contribute).