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
e7667f6f
Commit
e7667f6f
authored
Jul 16, 2020
by
Kaushik Shivakumar
Browse files
Merge branch 'master' of
https://github.com/tensorflow/models
into context_tf2
parents
974c463e
709a6617
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
15 deletions
+27
-15
research/deeplab/datasets/build_cityscapes_data.py
research/deeplab/datasets/build_cityscapes_data.py
+17
-7
research/deeplab/datasets/convert_cityscapes.sh
research/deeplab/datasets/convert_cityscapes.sh
+2
-0
research/deeplab/deprecated/segmentation_dataset.py
research/deeplab/deprecated/segmentation_dataset.py
+2
-2
research/deeplab/g3doc/cityscapes.md
research/deeplab/g3doc/cityscapes.md
+3
-3
research/deeplab/g3doc/installation.md
research/deeplab/g3doc/installation.md
+1
-1
research/deeplab/local_test.sh
research/deeplab/local_test.sh
+2
-2
No files found.
research/deeplab/datasets/build_cityscapes_data.py
View file @
e7667f6f
...
@@ -113,17 +113,23 @@ def _get_files(data, dataset_split):
...
@@ -113,17 +113,23 @@ def _get_files(data, dataset_split):
Args:
Args:
data: String, desired data ('image' or 'label').
data: String, desired data ('image' or 'label').
dataset_split: String, dataset split ('train', 'val', 'test')
dataset_split: String, dataset split ('train
_fine
', 'val
_fine
', 'test
_fine
')
Returns:
Returns:
A list of sorted file names or None when getting label for
A list of sorted file names or None when getting label for
test set.
test set.
"""
"""
if
data
==
'label'
and
dataset_split
==
'test'
:
if
dataset_split
==
'train_fine'
:
return
None
split_dir
=
'train'
elif
dataset_split
==
'val_fine'
:
split_dir
=
'val'
elif
dataset_split
==
'test_fine'
:
split_dir
=
'test'
else
:
raise
RuntimeError
(
"Split {} is not supported"
.
format
(
dataset_split
))
pattern
=
'*%s.%s'
%
(
_POSTFIX_MAP
[
data
],
_DATA_FORMAT_MAP
[
data
])
pattern
=
'*%s.%s'
%
(
_POSTFIX_MAP
[
data
],
_DATA_FORMAT_MAP
[
data
])
search_files
=
os
.
path
.
join
(
search_files
=
os
.
path
.
join
(
FLAGS
.
cityscapes_root
,
_FOLDERS_MAP
[
data
],
dataset_
split
,
'*'
,
pattern
)
FLAGS
.
cityscapes_root
,
_FOLDERS_MAP
[
data
],
split
_dir
,
'*'
,
pattern
)
filenames
=
glob
.
glob
(
search_files
)
filenames
=
glob
.
glob
(
search_files
)
return
sorted
(
filenames
)
return
sorted
(
filenames
)
...
@@ -132,7 +138,7 @@ def _convert_dataset(dataset_split):
...
@@ -132,7 +138,7 @@ def _convert_dataset(dataset_split):
"""Converts the specified dataset split to TFRecord format.
"""Converts the specified dataset split to TFRecord format.
Args:
Args:
dataset_split: The dataset split (e.g., train
, val
).
dataset_split: The dataset split (e.g., train
_fine, val_fine
).
Raises:
Raises:
RuntimeError: If loaded image and label have different shape, or if the
RuntimeError: If loaded image and label have different shape, or if the
...
@@ -142,8 +148,12 @@ def _convert_dataset(dataset_split):
...
@@ -142,8 +148,12 @@ def _convert_dataset(dataset_split):
label_files
=
_get_files
(
'label'
,
dataset_split
)
label_files
=
_get_files
(
'label'
,
dataset_split
)
num_images
=
len
(
image_files
)
num_images
=
len
(
image_files
)
num_labels
=
len
(
label_files
)
num_per_shard
=
int
(
math
.
ceil
(
num_images
/
_NUM_SHARDS
))
num_per_shard
=
int
(
math
.
ceil
(
num_images
/
_NUM_SHARDS
))
if
num_images
!=
num_labels
:
raise
RuntimeError
(
"The number of images and labels doesn't match: {} {}"
.
format
(
num_images
,
num_labels
))
image_reader
=
build_data
.
ImageReader
(
'png'
,
channels
=
3
)
image_reader
=
build_data
.
ImageReader
(
'png'
,
channels
=
3
)
label_reader
=
build_data
.
ImageReader
(
'png'
,
channels
=
1
)
label_reader
=
build_data
.
ImageReader
(
'png'
,
channels
=
1
)
...
@@ -179,8 +189,8 @@ def _convert_dataset(dataset_split):
...
@@ -179,8 +189,8 @@ def _convert_dataset(dataset_split):
def
main
(
unused_argv
):
def
main
(
unused_argv
):
# Only support converting 'train
' and 'val
' sets for now.
# Only support converting 'train
_fine', 'val_fine' and 'test_fine
' sets for now.
for
dataset_split
in
[
'train'
,
'val'
]:
for
dataset_split
in
[
'train
_fine
'
,
'val
_fine'
,
'test_fine
'
]:
_convert_dataset
(
dataset_split
)
_convert_dataset
(
dataset_split
)
...
...
research/deeplab/datasets/convert_cityscapes.sh
View file @
e7667f6f
...
@@ -42,6 +42,8 @@ WORK_DIR="."
...
@@ -42,6 +42,8 @@ WORK_DIR="."
# Root path for Cityscapes dataset.
# Root path for Cityscapes dataset.
CITYSCAPES_ROOT
=
"
${
WORK_DIR
}
/cityscapes"
CITYSCAPES_ROOT
=
"
${
WORK_DIR
}
/cityscapes"
export
PYTHONPATH
=
"
${
CITYSCAPES_ROOT
}
:
${
PYTHONPATH
}
"
# Create training labels.
# Create training labels.
python
"
${
CITYSCAPES_ROOT
}
/cityscapesscripts/preparation/createTrainIdLabelImgs.py"
python
"
${
CITYSCAPES_ROOT
}
/cityscapesscripts/preparation/createTrainIdLabelImgs.py"
...
...
research/deeplab/deprecated/segmentation_dataset.py
View file @
e7667f6f
...
@@ -81,8 +81,8 @@ DatasetDescriptor = collections.namedtuple(
...
@@ -81,8 +81,8 @@ DatasetDescriptor = collections.namedtuple(
_CITYSCAPES_INFORMATION
=
DatasetDescriptor
(
_CITYSCAPES_INFORMATION
=
DatasetDescriptor
(
splits_to_sizes
=
{
splits_to_sizes
=
{
'train'
:
2975
,
'train
_fine
'
:
2975
,
'val'
:
500
,
'val
_fine
'
:
500
,
},
},
num_classes
=
19
,
num_classes
=
19
,
ignore_label
=
255
,
ignore_label
=
255
,
...
...
research/deeplab/g3doc/cityscapes.md
View file @
e7667f6f
...
@@ -43,7 +43,7 @@ A local training job using `xception_65` can be run with the following command:
...
@@ -43,7 +43,7 @@ A local training job using `xception_65` can be run with the following command:
python deeplab/train.py
\
python deeplab/train.py
\
--logtostderr
\
--logtostderr
\
--training_number_of_steps
=
90000
\
--training_number_of_steps
=
90000
\
--train_split
=
"train"
\
--train_split
=
"train
_fine
"
\
--model_variant
=
"xception_65"
\
--model_variant
=
"xception_65"
\
--atrous_rates
=
6
\
--atrous_rates
=
6
\
--atrous_rates
=
12
\
--atrous_rates
=
12
\
...
@@ -95,7 +95,7 @@ command:
...
@@ -95,7 +95,7 @@ command:
# From tensorflow/models/research/
# From tensorflow/models/research/
python deeplab/eval.py
\
python deeplab/eval.py
\
--logtostderr
\
--logtostderr
\
--eval_split
=
"val"
\
--eval_split
=
"val
_fine
"
\
--model_variant
=
"xception_65"
\
--model_variant
=
"xception_65"
\
--atrous_rates
=
6
\
--atrous_rates
=
6
\
--atrous_rates
=
12
\
--atrous_rates
=
12
\
...
@@ -121,7 +121,7 @@ command:
...
@@ -121,7 +121,7 @@ command:
# From tensorflow/models/research/
# From tensorflow/models/research/
python deeplab/vis.py
\
python deeplab/vis.py
\
--logtostderr
\
--logtostderr
\
--vis_split
=
"val"
\
--vis_split
=
"val
_fine
"
\
--model_variant
=
"xception_65"
\
--model_variant
=
"xception_65"
\
--atrous_rates
=
6
\
--atrous_rates
=
6
\
--atrous_rates
=
12
\
--atrous_rates
=
12
\
...
...
research/deeplab/g3doc/installation.md
View file @
e7667f6f
...
@@ -68,6 +68,6 @@ Quick running the whole code on the PASCAL VOC 2012 dataset:
...
@@ -68,6 +68,6 @@ Quick running the whole code on the PASCAL VOC 2012 dataset:
```
bash
```
bash
# From tensorflow/models/research/deeplab
# From tensorflow/models/research/deeplab
sh local_test.sh
ba
sh local_test.sh
```
```
research/deeplab/local_test.sh
View file @
e7667f6f
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#
#
# Usage:
# Usage:
# # From the tensorflow/models/research/deeplab directory.
# # From the tensorflow/models/research/deeplab directory.
# sh ./local_test.sh
#
ba
sh ./local_test.sh
#
#
#
#
...
@@ -42,7 +42,7 @@ python "${WORK_DIR}"/model_test.py
...
@@ -42,7 +42,7 @@ python "${WORK_DIR}"/model_test.py
# Go to datasets folder and download PASCAL VOC 2012 segmentation dataset.
# Go to datasets folder and download PASCAL VOC 2012 segmentation dataset.
DATASET_DIR
=
"datasets"
DATASET_DIR
=
"datasets"
cd
"
${
WORK_DIR
}
/
${
DATASET_DIR
}
"
cd
"
${
WORK_DIR
}
/
${
DATASET_DIR
}
"
sh download_and_convert_voc2012.sh
ba
sh download_and_convert_voc2012.sh
# Go back to original directory.
# Go back to original directory.
cd
"
${
CURRENT_DIR
}
"
cd
"
${
CURRENT_DIR
}
"
...
...
Prev
1
2
Next
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