Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Tensor Names in DeepSORT Integration with FaceNET Model #1243

Open
droczy opened this issue Nov 1, 2023 · 0 comments
Open

Issue with Tensor Names in DeepSORT Integration with FaceNET Model #1243

droczy opened this issue Nov 1, 2023 · 0 comments

Comments

@droczy
Copy link

droczy commented Nov 1, 2023

My primary objective is to anonymize faces in videos. Initially, I employed CenterFace for face detection. However, I noticed that especially in side profiles or under poor lighting conditions, the bounding boxes tend to jitter or shift abruptly. This observation led me to consider implementing face tracking to achieve more consistent results. I moved towards DeepSORT because of its resilience, especially when bounding boxes disappear or fluctuate rapidly. While DeepSORT is traditionally designed for individual tracking using the Mars model, my focus is on tracking faces. I've chosen the FaceNET model for face tracking.

I've encountered a challenge: DeepSORT requires the specification of input and output tensor names. I'm utilizing the pre-trained model (20180402-114759) available in the repository. However, when I attempt to visualize the model using Tensorboard or retrieve the list of tensors, I'm unable to identify the correct tensor names. TensorFlow often automatically names the input tensor as 'input:0', but this tensor appears to be missing from the model.

Could anyone assist me in identifying the correct tensor names?

System Specifications:

OS: Ubuntu 22.04.3 LTS
TensorFlow Version: 2.14.0
DeepSORT Version: Updated for TensorFlow 2.x (utilizing tf.compat.v1)

Relevant Code from DeepSORT (generate_detections.py):
`class ImageEncoder(object):

def __init__(self, checkpoint_filename, input_name="images",
             output_name="features"):
    self.session = tf.compat.v1.Session()
    with tf.compat.v1.gfile.GFile(checkpoint_filename, "rb") as file_handle:
        graph_def = tf.compat.v1.GraphDef()
        graph_def.ParseFromString(file_handle.read())
    tf.compat.v1.import_graph_def(graph_def, name="net")
    self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name("input:0")
    self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name("embeddings:0")`

Error Log:
File ".../deep_sort/tools/generate_detections.py", line 98, in create_box_encoder image_encoder = ImageEncoder(model_filename, input_name, output_name) File ".../deep_sort/tools/generate_detections.py", line 80, in __init__ self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name("input:0")

If you need further code snippets or have any questions/suggestions, please don't hesitate to reach out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant