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
bddffa3e
Commit
bddffa3e
authored
Oct 23, 2021
by
Vishnu Banna
Browse files
model output size
parent
89eb58bc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
22 deletions
+20
-22
official/vision/beta/projects/yolo/dataloaders/yolo_input.py
official/vision/beta/projects/yolo/dataloaders/yolo_input.py
+1
-2
official/vision/beta/projects/yolo/dataloaders/yolo_input_test.py
.../vision/beta/projects/yolo/dataloaders/yolo_input_test.py
+2
-2
official/vision/beta/projects/yolo/ops/mosaic.py
official/vision/beta/projects/yolo/ops/mosaic.py
+2
-4
official/vision/beta/projects/yolo/ops/preprocessing_ops.py
official/vision/beta/projects/yolo/ops/preprocessing_ops.py
+15
-14
No files found.
official/vision/beta/projects/yolo/dataloaders/yolo_input.py
View file @
bddffa3e
...
@@ -286,8 +286,7 @@ class Parser(parser.Parser):
...
@@ -286,8 +286,7 @@ class Parser(parser.Parser):
# Clip and clean boxes.
# Clip and clean boxes.
image
=
image
/
255.0
image
=
image
/
255.0
boxes
,
inds
=
preprocessing_ops
.
transform_and_clip_boxes
(
boxes
,
inds
=
preprocessing_ops
.
transform_and_clip_boxes
(
boxes
,
infos
,
shuffle_boxes
=
False
,
area_thresh
=
0.0
,
augment
=
True
,
boxes
,
infos
,
shuffle_boxes
=
False
,
area_thresh
=
0.0
,
augment
=
True
)
output_size
=
[
self
.
_image_h
,
self
.
_image_w
])
classes
=
tf
.
gather
(
classes
,
inds
)
classes
=
tf
.
gather
(
classes
,
inds
)
info
=
infos
[
-
1
]
info
=
infos
[
-
1
]
...
...
official/vision/beta/projects/yolo/dataloaders/yolo_input_test.py
View file @
bddffa3e
...
@@ -115,5 +115,5 @@ class YoloDetectionInputTest(tf.test.TestCase, parameterized.TestCase):
...
@@ -115,5 +115,5 @@ class YoloDetectionInputTest(tf.test.TestCase, parameterized.TestCase):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
tf
.
test
.
main
()
# tf.test.main()
test_yolo_pipeline_visually
(
is_training
=
False
,
num
=
20
)
test_yolo_pipeline_visually
(
is_training
=
True
,
num
=
20
)
\ No newline at end of file
\ No newline at end of file
official/vision/beta/projects/yolo/ops/mosaic.py
View file @
bddffa3e
...
@@ -180,8 +180,7 @@ class Mosaic:
...
@@ -180,8 +180,7 @@ class Mosaic:
area_thresh
=
self
.
_area_thresh
,
area_thresh
=
self
.
_area_thresh
,
shuffle_boxes
=
False
,
shuffle_boxes
=
False
,
augment
=
True
,
augment
=
True
,
seed
=
self
.
_seed
,
seed
=
self
.
_seed
)
output_size
=
[
self
.
_output_size
[
0
],
self
.
_output_size
[
1
]])
classes
,
is_crowd
,
area
=
self
.
_select_ind
(
inds
,
classes
,
is_crowd
,
area
)
# pylint:disable=unbalanced-tuple-unpacking
classes
,
is_crowd
,
area
=
self
.
_select_ind
(
inds
,
classes
,
is_crowd
,
area
)
# pylint:disable=unbalanced-tuple-unpacking
return
image
,
boxes
,
classes
,
is_crowd
,
area
,
crop_points
return
image
,
boxes
,
classes
,
is_crowd
,
area
,
crop_points
...
@@ -230,8 +229,7 @@ class Mosaic:
...
@@ -230,8 +229,7 @@ class Mosaic:
None
,
None
,
affine
=
affine
,
affine
=
affine
,
area_thresh
=
self
.
_area_thresh
,
area_thresh
=
self
.
_area_thresh
,
seed
=
self
.
_seed
,
seed
=
self
.
_seed
)
output_size
=
[
self
.
_output_size
[
0
],
self
.
_output_size
[
1
]])
classes
,
is_crowd
,
area
=
self
.
_select_ind
(
inds
,
classes
,
is_crowd
,
area
)
# pylint:disable=unbalanced-tuple-unpacking
classes
,
is_crowd
,
area
=
self
.
_select_ind
(
inds
,
classes
,
is_crowd
,
area
)
# pylint:disable=unbalanced-tuple-unpacking
return
image
,
boxes
,
classes
,
is_crowd
,
area
,
area
return
image
,
boxes
,
classes
,
is_crowd
,
area
,
area
...
...
official/vision/beta/projects/yolo/ops/preprocessing_ops.py
View file @
bddffa3e
...
@@ -780,8 +780,8 @@ def boxes_candidates(clipped_boxes,
...
@@ -780,8 +780,8 @@ def boxes_candidates(clipped_boxes,
clipped_height
/
(
clipped_width
+
1e-16
))
clipped_height
/
(
clipped_width
+
1e-16
))
# Ensure the clipped width adn height are larger than a preset threshold.
# Ensure the clipped width adn height are larger than a preset threshold.
conda
=
clipped_width
>
wh_thr
conda
=
clipped_width
>
=
wh_thr
condb
=
clipped_height
>
wh_thr
condb
=
clipped_height
>
=
wh_thr
# Ensure the area of the clipped box is larger than the area threshold.
# Ensure the area of the clipped box is larger than the area threshold.
area
=
(
clipped_height
*
clipped_width
)
/
(
og_width
*
og_height
+
1e-16
)
area
=
(
clipped_height
*
clipped_width
)
/
(
og_width
*
og_height
+
1e-16
)
...
@@ -839,8 +839,7 @@ def transform_and_clip_boxes(boxes,
...
@@ -839,8 +839,7 @@ def transform_and_clip_boxes(boxes,
shuffle_boxes
=
False
,
shuffle_boxes
=
False
,
area_thresh
=
0.1
,
area_thresh
=
0.1
,
seed
=
None
,
seed
=
None
,
augment
=
True
,
augment
=
True
):
output_size
=
None
):
"""Clips and cleans the boxes.
"""Clips and cleans the boxes.
Args:
Args:
...
@@ -871,10 +870,11 @@ def transform_and_clip_boxes(boxes,
...
@@ -871,10 +870,11 @@ def transform_and_clip_boxes(boxes,
# Make sure all boxes are valid to start, clip to [0, 1] and get only the
# Make sure all boxes are valid to start, clip to [0, 1] and get only the
# valid boxes.
# valid boxes.
if
output_size
is
None
:
# if output_size is None:
output_size
=
tf
.
cast
([
640
,
640
],
tf
.
float32
)
# output_size = tf.cast([640, 640], tf.float32)
else
:
# else:
output_size
=
tf
.
cast
(
output_size
,
tf
.
float32
)
# output_size = tf.cast(output_size, tf.float32)
output_size
=
None
if
augment
:
if
augment
:
boxes
=
tf
.
math
.
maximum
(
tf
.
math
.
minimum
(
boxes
,
1.0
),
0.0
)
boxes
=
tf
.
math
.
maximum
(
tf
.
math
.
minimum
(
boxes
,
1.0
),
0.0
)
cond
=
get_valid_boxes
(
boxes
)
cond
=
get_valid_boxes
(
boxes
)
...
@@ -925,15 +925,16 @@ def transform_and_clip_boxes(boxes,
...
@@ -925,15 +925,16 @@ def transform_and_clip_boxes(boxes,
# Threshold the existing boxes.
# Threshold the existing boxes.
if
augment
:
if
augment
:
boxes_
=
bbox_ops
.
denormalize_boxes
(
boxes
,
output_size
)
if
output_size
is
not
None
:
box_history_
=
bbox_ops
.
denormalize_boxes
(
box_history
,
output_size
)
boxes_
=
bbox_ops
.
denormalize_boxes
(
boxes
,
output_size
)
inds
=
boxes_candidates
(
boxes_
,
box_history_
,
area_thr
=
area_thresh
)
box_history_
=
bbox_ops
.
denormalize_boxes
(
box_history
,
output_size
)
inds
=
boxes_candidates
(
boxes_
,
box_history_
,
area_thr
=
area_thresh
)
else
:
inds
=
boxes_candidates
(
boxes
,
box_history
,
wh_thr
=
0.0
,
area_thr
=
area_thresh
)
# Select and gather the good boxes.
# Select and gather the good boxes.
if
shuffle_boxes
:
if
shuffle_boxes
:
inds
=
tf
.
random
.
shuffle
(
inds
,
seed
=
seed
)
inds
=
tf
.
random
.
shuffle
(
inds
,
seed
=
seed
)
else
:
else
:
boxes
=
box_history
inds
=
bbox_ops
.
get_non_empty_box_indices
(
boxes
)
boxes_
=
bbox_ops
.
denormalize_boxes
(
boxes
,
output_size
)
inds
=
bbox_ops
.
get_non_empty_box_indices
(
boxes_
)
boxes
=
tf
.
gather
(
boxes
,
inds
)
boxes
=
tf
.
gather
(
boxes
,
inds
)
return
boxes
,
inds
return
boxes
,
inds
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