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
e570fda5
"driver/vscode:/vscode.git/clone" did not exist on "96d73c2154e41094a010f4aed9169e028af859d1"
Commit
e570fda5
authored
Jun 15, 2021
by
Gunho Park
Browse files
Internal change
parent
25bf4592
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
27 deletions
+4
-27
official/vision/beta/projects/basnet/evaluation/mae.py
official/vision/beta/projects/basnet/evaluation/mae.py
+1
-7
official/vision/beta/projects/basnet/evaluation/max_f.py
official/vision/beta/projects/basnet/evaluation/max_f.py
+1
-8
official/vision/beta/projects/basnet/evaluation/relax_f.py
official/vision/beta/projects/basnet/evaluation/relax_f.py
+1
-10
official/vision/beta/projects/basnet/modeling/layers/nn_blocks.py
.../vision/beta/projects/basnet/modeling/layers/nn_blocks.py
+1
-1
official/vision/beta/projects/basnet/tasks/basnet.py
official/vision/beta/projects/basnet/tasks/basnet.py
+0
-1
No files found.
official/vision/beta/projects/basnet/evaluation/mae.py
View file @
e570fda5
...
...
@@ -26,11 +26,7 @@ class MAE(object):
"""Mean Absolute Error(MAE) metric for basnet."""
def
__init__
(
self
):
"""Constructs MAE metric class.
Args:
"""
"""Constructs MAE metric class."""
self
.
reset_states
()
@
property
...
...
@@ -55,7 +51,6 @@ class MAE(object):
Returns:
average_mae: average MAE with float numpy.
"""
mae_total
=
0.0
for
i
,
(
true
,
pred
)
in
enumerate
(
zip
(
self
.
_groundtruths
,
...
...
@@ -72,7 +67,6 @@ class MAE(object):
def
_mask_normalize
(
self
,
mask
):
return
mask
/
(
np
.
amax
(
mask
)
+
1e-8
)
def
_compute_mae
(
self
,
true
,
pred
):
h
,
w
=
true
.
shape
[
0
],
true
.
shape
[
1
]
mask1
=
self
.
_mask_normalize
(
true
)
...
...
official/vision/beta/projects/basnet/evaluation/max_f.py
View file @
e570fda5
...
...
@@ -26,12 +26,7 @@ class maxFscore(object):
"""Maximum F-score metric for basnet."""
def
__init__
(
self
):
"""Constructs BASNet evaluation class.
Args:
"""
"""Constructs BASNet evaluation class."""
self
.
reset_states
()
@
property
...
...
@@ -76,7 +71,6 @@ class maxFscore(object):
recalls
=
np
.
sum
(
recalls
,
0
)
/
(
len
(
self
.
_groundtruths
)
+
1e-8
)
f
=
(
1
+
beta
)
*
precisions
*
recalls
/
(
beta
*
precisions
+
recalls
+
1e-8
)
f_max
=
np
.
max
(
f
)
f_max
=
f_max
.
astype
(
np
.
float32
)
return
f_max
...
...
@@ -128,7 +122,6 @@ class maxFscore(object):
groundtruth masks. range [0, 1]
predictions : Tuple of signle Tensor [batch, width, height, 1],
predicted masks. range [0, 1]
"""
groundtruths
,
predictions
=
self
.
_convert_to_numpy
(
groundtruths
[
0
],
predictions
[
0
])
...
...
official/vision/beta/projects/basnet/evaluation/relax_f.py
View file @
e570fda5
...
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Metrics for basnet"""
# Import libraries
import
numpy
as
np
...
...
@@ -23,12 +22,7 @@ class relaxedFscore(object):
"""Relaxed F-score metric for basnet."""
def
__init__
(
self
):
"""Constructs BASNet evaluation class.
Args:
"""
"""Constructs BASNet evaluation class."""
self
.
reset_states
()
@
property
...
...
@@ -87,9 +81,7 @@ class relaxedFscore(object):
pre
,
rec
=
self
.
_compute_relax_pre_rec
(
true_xor
,
pred_xor
,
rho
)
relax_fs
[
i
]
=
(
1
+
beta
)
*
pre
*
rec
/
(
beta
*
pre
+
rec
+
1e-8
)
relax_f
=
np
.
sum
(
relax_fs
,
0
)
/
(
len
(
self
.
_groundtruths
)
+
1e-8
)
relax_f
=
relax_f
.
astype
(
np
.
float32
)
return
relax_f
...
...
@@ -134,7 +126,6 @@ class relaxedFscore(object):
groundtruth masks. range [0, 1]
predictions : Tuple of single Tensor [batch, width, height, 1],
predicted masks. range [0, 1]
"""
groundtruths
,
predictions
=
self
.
_convert_to_numpy
(
groundtruths
[
0
],
...
...
official/vision/beta/projects/basnet/modeling/layers/nn_blocks.py
View file @
e570fda5
...
...
@@ -27,7 +27,7 @@ class ConvBlock(tf.keras.layers.Layer):
def
__init__
(
self
,
filters
,
strides
,
dilation_rate
,
dilation_rate
=
1
,
kernel_size
=
3
,
kernel_initializer
=
'VarianceScaling'
,
kernel_regularizer
=
None
,
...
...
official/vision/beta/projects/basnet/tasks/basnet.py
View file @
e570fda5
...
...
@@ -46,7 +46,6 @@ def build_basnet_model(
norm_activation_config
=
model_config
.
norm_activation
decoder
=
basnet_decoder
.
BASNet_Decoder
(
input_specs
=
backbone
.
output_specs
,
use_sync_bn
=
norm_activation_config
.
use_sync_bn
,
norm_momentum
=
norm_activation_config
.
norm_momentum
,
norm_epsilon
=
norm_activation_config
.
norm_epsilon
,
...
...
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