Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
f2f7e39c
Commit
f2f7e39c
authored
Feb 15, 2022
by
Fan Yang
Committed by
A. Unique TensorFlower
Feb 15, 2022
Browse files
Internal change
PiperOrigin-RevId: 428802917
parent
9c8cbd0c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
22 deletions
+21
-22
official/vision/examples/starter/README.md
official/vision/examples/starter/README.md
+7
-7
official/vision/examples/starter/example_config.py
official/vision/examples/starter/example_config.py
+1
-2
official/vision/examples/starter/example_config_local.yaml
official/vision/examples/starter/example_config_local.yaml
+0
-0
official/vision/examples/starter/example_config_tpu.yaml
official/vision/examples/starter/example_config_tpu.yaml
+0
-0
official/vision/examples/starter/example_input.py
official/vision/examples/starter/example_input.py
+3
-3
official/vision/examples/starter/example_model.py
official/vision/examples/starter/example_model.py
+1
-1
official/vision/examples/starter/example_task.py
official/vision/examples/starter/example_task.py
+4
-4
official/vision/examples/starter/registry_imports.py
official/vision/examples/starter/registry_imports.py
+4
-4
official/vision/examples/starter/train.py
official/vision/examples/starter/train.py
+1
-1
No files found.
official/vision/
beta/projects/example
/README.md
→
official/vision/
examples/starter
/README.md
View file @
f2f7e39c
...
...
@@ -35,14 +35,14 @@ input and return an `ExampleModel` instance, similar as
As a simple example, we define a single model. However, you can split the model
implementation to individual components, such as backbones, decoders, heads, as
what we do
[
here
](
https://github.com/tensorflow/models/blob/master/official/vision/
beta/
modeling
)
.
[
here
](
https://github.com/tensorflow/models/blob/master/official/vision/modeling
)
.
And then in
`build_example_model`
function, you can hook up these components
together to obtain your full model.
## Create Dataloader
A dataloader reads, decodes and parses the input data. We have created various
[
dataloaders
](
https://github.com/tensorflow/models/blob/master/official/vision/
beta/
dataloaders
)
[
dataloaders
](
https://github.com/tensorflow/models/blob/master/official/vision/dataloaders
)
to handle standard input formats for classification, detection and segmentation.
If you have non-standard or complex data, you may want to create your own
dataloader. It contains a
`Decoder`
and a
`Parser`
.
...
...
@@ -123,10 +123,10 @@ together and is called by the base
You can create your own task by inheriting from base
[
Task
](
https://github.com/tensorflow/models/blob/master/official/core/base_task.py
)
,
or from one of the
[
tasks
](
https://github.com/tensorflow/models/blob/master/official/vision/
beta/
tasks/
)
[
tasks
](
https://github.com/tensorflow/models/blob/master/official/vision/tasks/
)
we already defined, if most of the operations can be reused. An
`ExampleTask`
inheriting from
[
ImageClassificationTask
](
https://github.com/tensorflow/models/blob/master/official/vision/
beta/
tasks/image_classification.py#L32
)
[
ImageClassificationTask
](
https://github.com/tensorflow/models/blob/master/official/vision/tasks/image_classification.py#L32
)
can be found
[
here
](
example_task.py
)
.
We will go through each important components in the task in the following.
...
...
@@ -175,7 +175,7 @@ from official.vision.beta.projects.example import example_task
## Training
You can create your own trainer by branching from our core
[
trainer
](
https://github.com/tensorflow/models/blob/master/official/vision/
beta/
train.py
)
.
[
trainer
](
https://github.com/tensorflow/models/blob/master/official/vision/train.py
)
.
Just make sure you import the registry like this:
```
python
...
...
@@ -185,7 +185,7 @@ from official.vision.beta.projects.example import registry_imports # pylint: di
You can run training locally for testing purpose:
```
bash
# Assume you are under official/vision/
beta/
projects.
# Assume you are under official/vision/projects.
python3 example/train.py
\
--experiment
=
tf_vision_example_experiment
\
--config_file
=
${
PWD
}
/example/example_config_local.yaml
\
...
...
@@ -210,5 +210,5 @@ python3 example/train.py \
--mode
=
train
\
--tpu
=
$TPU_NAME
\
--model_dir
=
/tmp/tfvision_test/
--config_file
=
third_party/tensorflow_models/official/vision/
beta/projects/example
/example_config_tpu.yaml
--config_file
=
third_party/tensorflow_models/official/vision/
examples/starter
/example_config_tpu.yaml
```
official/vision/
beta/projects/example
/example_config.py
→
official/vision/
examples/starter
/example_config.py
View file @
f2f7e39c
...
...
@@ -13,9 +13,8 @@
# limitations under the License.
"""Example experiment configuration definition."""
from
typing
import
List
import
dataclasses
from
typing
import
List
from
official.core
import
config_definitions
as
cfg
from
official.core
import
exp_factory
...
...
official/vision/
beta/projects/example
/example_config_local.yaml
→
official/vision/
examples/starter
/example_config_local.yaml
View file @
f2f7e39c
File moved
official/vision/
beta/projects/example
/example_config_tpu.yaml
→
official/vision/
examples/starter
/example_config_tpu.yaml
View file @
f2f7e39c
File moved
official/vision/
beta/projects/example
/example_input.py
→
official/vision/
examples/starter
/example_input.py
View file @
f2f7e39c
...
...
@@ -22,9 +22,9 @@ from typing import Mapping, List, Tuple
# Import libraries
import
tensorflow
as
tf
from
official.vision.
beta.
dataloaders
import
decoder
from
official.vision.
beta.
dataloaders
import
parser
from
official.vision.
beta.
ops
import
preprocess_ops
from
official.vision.dataloaders
import
decoder
from
official.vision.dataloaders
import
parser
from
official.vision.ops
import
preprocess_ops
MEAN_RGB
=
(
0.485
*
255
,
0.456
*
255
,
0.406
*
255
)
STDDEV_RGB
=
(
0.229
*
255
,
0.224
*
255
,
0.225
*
255
)
...
...
official/vision/
beta/projects/example
/example_model.py
→
official/vision/
examples/starter
/example_model.py
View file @
f2f7e39c
...
...
@@ -22,7 +22,7 @@ directly used from `official/vision/beta/modeling` directory.
from
typing
import
Any
,
Mapping
# Import libraries
import
tensorflow
as
tf
from
official.vision.
beta.projects.example
import
example_config
as
example_cfg
from
official.vision.
examples.starter
import
example_config
as
example_cfg
class
ExampleModel
(
tf
.
keras
.
Model
):
...
...
official/vision/
beta/projects/example
/example_task.py
→
official/vision/
examples/starter
/example_task.py
View file @
f2f7e39c
...
...
@@ -21,10 +21,10 @@ from official.common import dataset_fn
from
official.core
import
base_task
from
official.core
import
task_factory
from
official.modeling
import
tf_utils
from
official.vision.
beta.
dataloaders
import
input_reader_factory
from
official.vision.
beta.projects.example
import
example_config
as
exp_cfg
from
official.vision.
beta.projects.example
import
example_input
from
official.vision.
beta.projects.example
import
example_model
from
official.vision.dataloaders
import
input_reader_factory
from
official.vision.
examples.starter
import
example_config
as
exp_cfg
from
official.vision.
examples.starter
import
example_input
from
official.vision.
examples.starter
import
example_model
@
task_factory
.
register_task_cls
(
exp_cfg
.
ExampleTask
)
...
...
official/vision/
beta/projects/example
/registry_imports.py
→
official/vision/
examples/starter
/registry_imports.py
View file @
f2f7e39c
...
...
@@ -21,7 +21,7 @@ to handle each file separately.
# pylint: disable=unused-import
from
official.common
import
registry_imports
from
official.vision.
beta.projects.example
import
example_config
from
official.vision.
beta.projects.example
import
example_input
from
official.vision.
beta.projects.example
import
example_model
from
official.vision.
beta.projects.example
import
example_task
from
official.vision.
examples.starter
import
example_config
from
official.vision.
examples.starter
import
example_input
from
official.vision.
examples.starter
import
example_model
from
official.vision.
examples.starter
import
example_task
official/vision/
beta/projects/example
/train.py
→
official/vision/
examples/starter
/train.py
View file @
f2f7e39c
...
...
@@ -22,7 +22,7 @@ from absl import app
from
official.common
import
flags
as
tfm_flags
from
official.vision.beta
import
train
from
official.vision.
beta.projects.example
import
registry_imports
# pylint: disable=unused-import
from
official.vision.
examples.starter
import
registry_imports
# pylint: disable=unused-import
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment