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
142444e0
"docs/git@developer.sourcefind.cn:hehl2/torchaudio.git" did not exist on "8f061987404d5b935ca26e0953a1e84a7131cf33"
Commit
142444e0
authored
Sep 21, 2021
by
Vishnu Banna
Browse files
var names
parent
e7ff1bec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
official/vision/beta/projects/yolo/dataloaders/tf_example_decoder.py
...sion/beta/projects/yolo/dataloaders/tf_example_decoder.py
+7
-6
No files found.
official/vision/beta/projects/yolo/dataloaders/tf_example_decoder.py
View file @
142444e0
...
@@ -25,27 +25,28 @@ def _coco91_to_80(classif, box, areas, iscrowds):
...
@@ -25,27 +25,28 @@ def _coco91_to_80(classif, box, areas, iscrowds):
"""Function used to reduce COCO 91 to COCO 80, or to convert from the 2017
"""Function used to reduce COCO 91 to COCO 80, or to convert from the 2017
foramt to the 2014 format"""
foramt to the 2014 format"""
# Vector where index i coralates to the class at index[i].
# Vector where index i coralates to the class at index[i].
x
=
[
class_ids
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
,
27
,
28
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
23
,
24
,
25
,
27
,
28
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
46
,
47
,
48
,
49
,
50
,
51
,
52
,
53
,
54
,
55
,
56
,
57
,
58
,
59
,
60
,
61
,
62
,
44
,
46
,
47
,
48
,
49
,
50
,
51
,
52
,
53
,
54
,
55
,
56
,
57
,
58
,
59
,
60
,
61
,
62
,
63
,
64
,
65
,
67
,
70
,
72
,
73
,
74
,
75
,
76
,
77
,
78
,
79
,
80
,
81
,
82
,
84
,
85
,
63
,
64
,
65
,
67
,
70
,
72
,
73
,
74
,
75
,
76
,
77
,
78
,
79
,
80
,
81
,
82
,
84
,
85
,
86
,
87
,
88
,
89
,
90
86
,
87
,
88
,
89
,
90
]
]
n
o
=
tf
.
expand_dims
(
tf
.
convert_to_tensor
(
x
),
axis
=
0
)
n
ew_classes
=
tf
.
expand_dims
(
tf
.
convert_to_tensor
(
class_ids
),
axis
=
0
)
# Resahpe the classes to in order to build a class mask.
# Resahpe the classes to in order to build a class mask.
c
e
=
tf
.
expand_dims
(
classif
,
axis
=-
1
)
c
lasses
=
tf
.
expand_dims
(
classif
,
axis
=-
1
)
# One hot the classificiations to match the 80 class format.
# One hot the classificiations to match the 80 class format.
ind
=
c
e
==
tf
.
cast
(
n
o
,
ce
.
dtype
)
ind
=
c
lasses
==
tf
.
cast
(
n
ew_classes
,
classes
.
dtype
)
# Select the max values.
# Select the max values.
co
=
tf
.
reshape
(
tf
.
math
.
argmax
(
tf
.
cast
(
ind
,
tf
.
float32
),
axis
=-
1
),
[
-
1
])
selected_class
=
tf
.
reshape
(
tf
.
math
.
argmax
(
tf
.
cast
(
ind
,
tf
.
float32
),
axis
=-
1
),
[
-
1
])
ind
=
tf
.
where
(
tf
.
reduce_any
(
ind
,
axis
=-
1
))
ind
=
tf
.
where
(
tf
.
reduce_any
(
ind
,
axis
=-
1
))
# Gather the valuable instances.
# Gather the valuable instances.
classif
=
tf
.
gather_nd
(
co
,
ind
)
classif
=
tf
.
gather_nd
(
selected_class
,
ind
)
box
=
tf
.
gather_nd
(
box
,
ind
)
box
=
tf
.
gather_nd
(
box
,
ind
)
areas
=
tf
.
gather_nd
(
areas
,
ind
)
areas
=
tf
.
gather_nd
(
areas
,
ind
)
iscrowds
=
tf
.
gather_nd
(
iscrowds
,
ind
)
iscrowds
=
tf
.
gather_nd
(
iscrowds
,
ind
)
...
...
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