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
f0cc83d0
Commit
f0cc83d0
authored
Oct 23, 2021
by
Vishnu Banna
Browse files
model
parent
91fafd7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
10 deletions
+7
-10
official/vision/beta/projects/yolo/dataloaders/yolo_input.py
official/vision/beta/projects/yolo/dataloaders/yolo_input.py
+3
-2
official/vision/beta/projects/yolo/ops/mosaic.py
official/vision/beta/projects/yolo/ops/mosaic.py
+1
-1
official/vision/beta/projects/yolo/ops/preprocessing_ops.py
official/vision/beta/projects/yolo/ops/preprocessing_ops.py
+3
-7
No files found.
official/vision/beta/projects/yolo/dataloaders/yolo_input.py
View file @
f0cc83d0
...
@@ -237,7 +237,7 @@ class Parser(parser.Parser):
...
@@ -237,7 +237,7 @@ class Parser(parser.Parser):
affine
=
affine
,
affine
=
affine
,
shuffle_boxes
=
False
,
shuffle_boxes
=
False
,
area_thresh
=
self
.
_area_thresh
,
area_thresh
=
self
.
_area_thresh
,
augment
=
True
,
filter_and_clip_boxes
=
True
,
seed
=
self
.
_seed
)
seed
=
self
.
_seed
)
classes
=
tf
.
gather
(
classes
,
inds
)
classes
=
tf
.
gather
(
classes
,
inds
)
info
=
infos
[
-
1
]
info
=
infos
[
-
1
]
...
@@ -286,7 +286,8 @@ class Parser(parser.Parser):
...
@@ -286,7 +286,8 @@ 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
,
filter_and_clip_boxes
=
False
)
classes
=
tf
.
gather
(
classes
,
inds
)
classes
=
tf
.
gather
(
classes
,
inds
)
info
=
infos
[
-
1
]
info
=
infos
[
-
1
]
...
...
official/vision/beta/projects/yolo/ops/mosaic.py
View file @
f0cc83d0
...
@@ -179,7 +179,7 @@ class Mosaic:
...
@@ -179,7 +179,7 @@ class Mosaic:
infos
,
infos
,
area_thresh
=
self
.
_area_thresh
,
area_thresh
=
self
.
_area_thresh
,
shuffle_boxes
=
False
,
shuffle_boxes
=
False
,
augment
=
True
,
filter_and_clip_boxes
=
True
,
seed
=
self
.
_seed
)
seed
=
self
.
_seed
)
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
...
...
official/vision/beta/projects/yolo/ops/preprocessing_ops.py
View file @
f0cc83d0
...
@@ -839,7 +839,7 @@ def transform_and_clip_boxes(boxes,
...
@@ -839,7 +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
):
filter_and_clip_boxes
=
True
):
"""Clips and cleans the boxes.
"""Clips and cleans the boxes.
Args:
Args:
...
@@ -870,12 +870,8 @@ def transform_and_clip_boxes(boxes,
...
@@ -870,12 +870,8 @@ 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:
# output_size = tf.cast([640, 640], tf.float32)
# else:
# output_size = tf.cast(output_size, tf.float32)
output_size
=
None
output_size
=
None
if
augment
:
if
filter_and_clip_boxes
:
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
)
...
@@ -924,7 +920,7 @@ def transform_and_clip_boxes(boxes,
...
@@ -924,7 +920,7 @@ def transform_and_clip_boxes(boxes,
boxes
*=
tf
.
cast
(
tf
.
expand_dims
(
cond
,
axis
=-
1
),
boxes
.
dtype
)
boxes
*=
tf
.
cast
(
tf
.
expand_dims
(
cond
,
axis
=-
1
),
boxes
.
dtype
)
# Threshold the existing boxes.
# Threshold the existing boxes.
if
augment
:
if
filter_and_clip_boxes
:
if
output_size
is
not
None
:
if
output_size
is
not
None
:
boxes_
=
bbox_ops
.
denormalize_boxes
(
boxes
,
output_size
)
boxes_
=
bbox_ops
.
denormalize_boxes
(
boxes
,
output_size
)
box_history_
=
bbox_ops
.
denormalize_boxes
(
box_history
,
output_size
)
box_history_
=
bbox_ops
.
denormalize_boxes
(
box_history
,
output_size
)
...
...
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