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
d4b61ba9
Commit
d4b61ba9
authored
Jun 20, 2021
by
anivegesana
Browse files
Punctuation
parent
085ca13e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
+20
-21
official/vision/beta/projects/yolo/dataloaders/yolo_detection_input.py
...on/beta/projects/yolo/dataloaders/yolo_detection_input.py
+1
-1
official/vision/beta/projects/yolo/ops/math_ops.py
official/vision/beta/projects/yolo/ops/math_ops.py
+1
-1
official/vision/beta/projects/yolo/ops/nms_ops.py
official/vision/beta/projects/yolo/ops/nms_ops.py
+6
-6
official/vision/beta/projects/yolo/ops/preprocess_ops.py
official/vision/beta/projects/yolo/ops/preprocess_ops.py
+12
-13
No files found.
official/vision/beta/projects/yolo/dataloaders/yolo_detection_input.py
View file @
d4b61ba9
...
...
@@ -67,7 +67,7 @@ class Parser(parser.Parser):
max_level: `int` number of maximum level of the output feature pyramid.
masks: a `Tensor`, `List` or `numpy.ndarray` for anchor masks.
max_process_size: an `int` for maximum image width and height.
min_process_size: an `int` for minimum image width and height
,
min_process_size: an `int` for minimum image width and height
.
max_num_instances: an `int` number of maximum number of instances in an
image.
random_flip: a `bool` if True, augment training with random horizontal
...
...
official/vision/beta/projects/yolo/ops/math_ops.py
View file @
d4b61ba9
...
...
@@ -3,7 +3,7 @@ import tensorflow as tf
def
rm_nan_inf
(
x
,
val
=
0.0
):
"""Remove nan and infinity
"""Remove nan and infinity
.
Args:
x: any `Tensor` of any type.
...
...
official/vision/beta/projects/yolo/ops/nms_ops.py
View file @
d4b61ba9
...
...
@@ -379,9 +379,9 @@ def segment_nms(boxes, classes, confidence, k, iou_thresh):
too similar, the closer to 1.0 the less that gets through.
Return:
boxes: filtered `Tensor` of shape [batch size, k, 4]
classes: filtered `Tensor` of shape [batch size, k, num_classes]
t
confidence: filtered `Tensor` of shape [batch size, k]
boxes: filtered `Tensor` of shape [batch size, k, 4]
.
classes: filtered `Tensor` of shape [batch size, k, num_classes]
.
confidence: filtered `Tensor` of shape [batch size, k]
.
"""
mrange
=
tf
.
range
(
k
)
mask_x
=
tf
.
tile
(
...
...
@@ -433,9 +433,9 @@ def nms(boxes,
before NMS.
Return:
boxes: filtered `Tensor` of shape [batch size, k, 4]
classes: filtered `Tensor` of shape [batch size, k, num_classes]
confidence: filtered `Tensor` of shape [batch size, k]
boxes: filtered `Tensor` of shape [batch size, k, 4]
.
classes: filtered `Tensor` of shape [batch size, k, num_classes]
.
confidence: filtered `Tensor` of shape [batch size, k]
.
"""
# sort the boxes
...
...
official/vision/beta/projects/yolo/ops/preprocess_ops.py
View file @
d4b61ba9
...
...
@@ -194,11 +194,11 @@ def get_best_anchor(y_true, anchors, width=1, height=1):
"""Gets the correct anchor that is assoiciated with each box using IOU.
Args:
y_true: tf.Tensor[] for the list of bounding boxes in the yolo format
y_true:
`
tf.Tensor[]
`
for the list of bounding boxes in the yolo format
.
anchors: list or tensor for the anchor boxes to be used in prediction
found via Kmeans
width: int for the image width
height: int for the image height
found via Kmeans
.
width: int for the image width
.
height: int for the image height
.
Returns:
tf.Tensor: y_true with the anchor associated with each ground truth
...
...
@@ -263,7 +263,7 @@ def build_grided_gt(y_true, mask, size, dtype, use_tie_breaker):
Args:
y_true: tf.Tensor[] ground truth
[box coords[0:4], classes_onehot[0:-1], best_fit_anchor_box]
[box coords[0:4], classes_onehot[0:-1], best_fit_anchor_box]
.
mask: list of the anchor boxes choresponding to the output,
ex. [1, 2, 3] tells this layer to predict only the first 3
anchors in the total.
...
...
@@ -273,7 +273,7 @@ def build_grided_gt(y_true, mask, size, dtype, use_tie_breaker):
use_tie_breaker: boolean value for wether or not to use the tie_breaker.
Returns:
tf.Tensor[] of shape [size, size, #of_anchors, 4, 1, num_classes]
tf.Tensor[] of shape [size, size, #of_anchors, 4, 1, num_classes]
.
"""
# unpack required components from the input ground truth
boxes
=
tf
.
cast
(
y_true
[
'bbox'
],
dtype
)
...
...
@@ -391,18 +391,18 @@ def build_batch_grided_gt(y_true, mask, size, dtype, use_tie_breaker):
Args:
y_true: tf.Tensor[] ground truth
[batch, box coords[0:4], classes_onehot[0:-1], best_fit_anchor_box]
[batch, box coords[0:4], classes_onehot[0:-1], best_fit_anchor_box]
.
mask: list of the anchor boxes choresponding to the output,
ex. [1, 2, 3] tells this layer to predict only the first 3 anchors
in the total.
size: the dimensions of this output, for regular, it progresses from
13, to 26, to 52
dtype: expected output datatype
use_tie_breaker: boolean value for wether or not to use the tie
breaker
13, to 26, to 52
.
dtype: expected output datatype
.
use_tie_breaker: boolean value for w
h
ether or not to use the tie
breaker
.
Returns:
tf.Tensor[] of shape [batch, size, size, #of_anchors, 4, 1, num_classes]
tf.Tensor[] of shape [batch, size, size, #of_anchors, 4, 1, num_classes]
.
"""
# unpack required components from the input ground truth
boxes
=
tf
.
cast
(
y_true
[
'bbox'
],
dtype
)
...
...
@@ -521,4 +521,3 @@ def build_batch_grided_gt(y_true, mask, size, dtype, use_tie_breaker):
update
=
update
.
stack
()
full
=
tf
.
tensor_scatter_nd_update
(
full
,
update_index
,
update
)
return
full
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