tensorflow / tensorflow/models

Memory Leak With Custom Object Detection Model Tensorflow

Open
#10,685 1 comment 0 reactions 3 assignees View on GitHub

@tombstone is already working on this.

Since Jul 7, 2022.

models:research:odapi type:bug
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

I am biggner in tensorflow. I used transfer learning machanism and create custom object detection model using "ssd_resnet101_v1_fpn_keras" pre-trained model.

I follow the below documentation for custom traning:

https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html

I observed one issue while I used it for detection it takes lot of RAM and not releasing it.

I am sharing you the code snippet where it took lot of RAM and not releasing it.

detect_fn = tf.saved_model.load(visa_icon_model)

visa_icon_detections = detect_fn(input_tensor

Memory profiler info:

301   1675.0 MiB    191.8 MiB           1           visa_icon_detections = detect_fn(input_tensor)

Note: I am facing issue with CPU memory not with GPU memory

As you can see, it's take 191.8 Mb RAM. It's not releasing it after competion the process.

I used gc.collect() and tf.keras.backend.clear_session() for releasing the memory.

Both is not working for me.

Please anyone can help me how can I solve this problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.