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
e0b33491
"git@developer.sourcefind.cn:modelzoo/gpt2-pytorch.git" did not exist on "d0d555090e3fceac9a3988c70f5b8933c261dc7d"
Commit
e0b33491
authored
Nov 17, 2021
by
Vishnu Banna
Browse files
kmeans unit_test
parent
7d1fb7c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
official/vision/beta/projects/yolo/ops/kmeans_test.py
official/vision/beta/projects/yolo/ops/kmeans_test.py
+38
-0
No files found.
official/vision/beta/projects/yolo/ops/kmeans_test.py
0 → 100644
View file @
e0b33491
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""box_ops tests."""
from
absl.testing
import
parameterized
import
numpy
as
np
import
tensorflow
as
tf
from
official.vision.beta.projects.yolo.ops
import
kmeans_anchors
class
InputUtilsTest
(
parameterized
.
TestCase
,
tf
.
test
.
TestCase
):
@
parameterized
.
parameters
((
9
,
3
,
100
))
def
test_kmeans
(
self
,
k
,
anchors_per_scale
,
samples
):
sample_list
=
[]
for
i
in
range
(
samples
):
boxes
=
tf
.
convert_to_tensor
(
np
.
random
.
uniform
(
0
,
1
,
[
k
*
100
,
4
]))
sample_list
.
append
({
"groundtruth_boxes"
:
boxes
,
"width"
:
10
,
"height"
:
10
})
kmeans
=
kmeans_anchors
.
AnchorKMeans
()
cl
=
kmeans
(
sample_list
,
k
,
anchors_per_scale
,
image_resolution
=
[
512
,
512
,
3
])
cl
=
tf
.
convert_to_tensor
(
cl
)
self
.
assertAllEqual
(
tf
.
shape
(
cl
).
numpy
(),
[
k
,
2
])
if
__name__
==
'__main__'
:
tf
.
test
.
main
()
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