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
cb386cfb
Commit
cb386cfb
authored
Jun 06, 2022
by
A. Unique TensorFlower
Browse files
Make dataset_fn as an optional input argument in Mask R-CNN.
PiperOrigin-RevId: 453274537
parent
5997d0df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
official/vision/tasks/maskrcnn.py
official/vision/tasks/maskrcnn.py
+10
-5
No files found.
official/vision/tasks/maskrcnn.py
View file @
cb386cfb
...
@@ -19,7 +19,7 @@ from typing import Any, Dict, Optional, List, Tuple, Mapping
...
@@ -19,7 +19,7 @@ from typing import Any, Dict, Optional, List, Tuple, Mapping
from
absl
import
logging
from
absl
import
logging
import
tensorflow
as
tf
import
tensorflow
as
tf
from
official.common
import
dataset_fn
from
official.common
import
dataset_fn
as
dataset_fn_lib
from
official.core
import
base_task
from
official.core
import
base_task
from
official.core
import
task_factory
from
official.core
import
task_factory
from
official.vision.configs
import
maskrcnn
as
exp_cfg
from
official.vision.configs
import
maskrcnn
as
exp_cfg
...
@@ -118,9 +118,11 @@ class MaskRCNNTask(base_task.Task):
...
@@ -118,9 +118,11 @@ class MaskRCNNTask(base_task.Task):
logging
.
info
(
'Finished loading pretrained checkpoint from %s'
,
logging
.
info
(
'Finished loading pretrained checkpoint from %s'
,
ckpt_dir_or_file
)
ckpt_dir_or_file
)
def
build_inputs
(
self
,
def
build_inputs
(
params
:
exp_cfg
.
DataConfig
,
self
,
input_context
:
Optional
[
tf
.
distribute
.
InputContext
]
=
None
):
params
:
exp_cfg
.
DataConfig
,
input_context
:
Optional
[
tf
.
distribute
.
InputContext
]
=
None
,
dataset_fn
:
Optional
[
dataset_fn_lib
.
PossibleDatasetType
]
=
None
):
"""Build input dataset."""
"""Build input dataset."""
decoder_cfg
=
params
.
decoder
.
get
()
decoder_cfg
=
params
.
decoder
.
get
()
if
params
.
decoder
.
type
==
'simple_decoder'
:
if
params
.
decoder
.
type
==
'simple_decoder'
:
...
@@ -157,9 +159,12 @@ class MaskRCNNTask(base_task.Task):
...
@@ -157,9 +159,12 @@ class MaskRCNNTask(base_task.Task):
include_mask
=
self
.
_task_config
.
model
.
include_mask
,
include_mask
=
self
.
_task_config
.
model
.
include_mask
,
mask_crop_size
=
params
.
parser
.
mask_crop_size
)
mask_crop_size
=
params
.
parser
.
mask_crop_size
)
if
not
dataset_fn
:
dataset_fn
=
dataset_fn_lib
.
pick_dataset_fn
(
params
.
file_type
)
reader
=
input_reader_factory
.
input_reader_generator
(
reader
=
input_reader_factory
.
input_reader_generator
(
params
,
params
,
dataset_fn
=
dataset_fn
.
pick_dataset_fn
(
params
.
file_type
)
,
dataset_fn
=
dataset_fn
,
decoder_fn
=
decoder
.
decode
,
decoder_fn
=
decoder
.
decode
,
parser_fn
=
parser
.
parse_fn
(
params
.
is_training
))
parser_fn
=
parser
.
parse_fn
(
params
.
is_training
))
dataset
=
reader
.
read
(
input_context
=
input_context
)
dataset
=
reader
.
read
(
input_context
=
input_context
)
...
...
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