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
sunzhq2
yidong-infer
Commits
4a699441
Commit
4a699441
authored
Jan 23, 2026
by
sunzhq2
Committed by
xuxo
Jan 23, 2026
Browse files
update facenet readme-hy
parent
b2293819
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
0 deletions
+93
-0
facenet/facenet/README-hy.md
facenet/facenet/README-hy.md
+17
-0
facenet/facenet/tools/check_pb.py
facenet/facenet/tools/check_pb.py
+76
-0
No files found.
facenet/facenet/README-hy.md
0 → 100644
View file @
4a699441
## .pb模型转换
-
python ./tools/pb_frozen_del_phase_train.py
## 转onnx格式
-
bash ./tools/tf_2_onnx.sh
## 转migraphx模型
-
bash ./tools/onnx_2_mxr.sh
## 模型推理
-
bash ./inference.sh
## ana.sh
-
bash ana.sh
## post.sh
-
bash post.sh
\ No newline at end of file
facenet/facenet/tools/check_pb.py
0 → 100644
View file @
4a699441
import
tensorflow
as
tf
from
tensorflow.python.platform
import
gfile
pb_path
=
'/home/sunzhq/workspace/yidong-infer/facenet/facenet/models_m/facenet-tmp/20180408-102900.pb'
with
tf
.
io
.
gfile
.
GFile
(
pb_path
,
'rb'
)
as
f
:
graph_def
=
tf
.
compat
.
v1
.
GraphDef
()
graph_def
.
ParseFromString
(
f
.
read
())
with
tf
.
Graph
().
as_default
()
as
graph
:
tf
.
import_graph_def
(
graph_def
,
name
=
''
)
ops
=
graph
.
get_operations
()
# --- 查找 Identity 操作,特别关注可能代表最终输出的 ---
print
(
"--- Identity Nodes (Potential Model Outputs) ---"
)
identity_ops
=
[
op
for
op
in
ops
if
op
.
type
==
"Identity"
]
# 存储映射到最终输出的 Identity 信息
final_outputs
=
[]
for
op
in
identity_ops
:
input_to_identity
=
op
.
inputs
[
0
]
producer_op
=
input_to_identity
.
op
# 尝试判断是否是模型的主要输出(例如,名称包含 embedding,或者 producer op 是常见的输出层类型)
# In Facenet, the final layer before normalization might be called 'embeddings' or similar.
# Common final ops could be MatMul, Add, BatchMatMul, etc., followed by normalization like L2Norm or similar.
# Let's look for the most likely candidate based on name patterns common in Facenet models.
# Look for a name pattern often used for the final embedding vector
if
(
'embedding'
in
input_to_identity
.
name
.
lower
()
or
'bottleneck'
in
input_to_identity
.
name
.
lower
()
or
producer_op
.
type
in
[
'MatMul'
,
'Add'
,
'BatchMatMulV2'
]):
# Common final computation types
final_outputs
.
append
({
'identity_name'
:
op
.
name
,
'final_output_name'
:
input_to_identity
.
name
,
'producer_name'
:
producer_op
.
name
,
'type'
:
producer_op
.
type
,
'shape'
:
input_to_identity
.
shape
,
'dtype'
:
input_to_identity
.
dtype
})
# Print only the potentially relevant final outputs
if
final_outputs
:
print
(
"Potential Model Output Candidates:"
)
for
out_info
in
final_outputs
:
print
(
f
" Identity Op:
{
out_info
[
'identity_name'
]
}
"
)
print
(
f
" Maps Output From:
{
out_info
[
'producer_name'
]
}
(Type:
{
out_info
[
'type'
]
}
)"
)
print
(
f
" Final Output Name:
{
out_info
[
'final_output_name'
]
}
"
)
print
(
f
" Shape:
{
out_info
[
'shape'
]
}
, Dtype:
{
out_info
[
'dtype'
]
}
"
)
print
(
" ---"
)
else
:
print
(
"No obvious final output Identity nodes found matching common patterns."
)
# --- Alternative: Check for common output layer names directly (if not mapped by Identity) ---
# This is less likely if Identity is used, but worth a quick check
print
(
"
\n
--- Checking for Common Embedding Layer Names ---"
)
potential_embedding_names
=
[
'embeddings'
,
'Bottleneck/BatchNorm/Reshape_1'
,
'prelogits'
,
'InceptionResnetV1/Bottleneck/Identity'
# Add more potential names based on the specific model architecture if needed
]
# Add a suffix like :0 if necessary, TensorFlow usually adds this implicitly for the first output
potential_embedding_names_with_suffix
=
[
name
+
':0'
for
name
in
potential_embedding_names
]
found_embedding_directly
=
False
for
op
in
ops
:
if
op
.
name
in
potential_embedding_names
or
op
.
name
+
':0'
in
potential_embedding_names_with_suffix
:
print
(
f
"Found potential embedding node directly:
{
op
.
name
}
"
)
for
output
in
op
.
outputs
:
print
(
f
" Output:
{
output
.
name
}
, Shape:
{
output
.
shape
}
, Dtype:
{
output
.
dtype
}
"
)
found_embedding_directly
=
True
break
# Assume the first match is the one
if
not
found_embedding_directly
:
print
(
" No direct match found for common embedding names."
)
\ No newline at end of file
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