tensorflow / tensorflow/models

ImportError: DLL load failed while importing cv2: Not enough memory resources are available to process this command

Open
#9,814 3 comments 0 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since Mar 21, 2021.

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

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [Yes] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • [Yes] I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • [Yes] I checked to make sure that this issue has not already been filed.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/tree/master/research/object_detection

2. Describe the bug

The bug happens when running the model_main_tf2.py for training a model.
It appears that it can't import directly the opencv library because of insufficient memory resources, but there is still plenty of my memory to use (>60% on CPU and >97% on GPU).

3. Steps to reproduce

The error comes out when I'm running the command: python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/ssd_efficientdet_d0_512x512_coco17_tpu-8.config. I used ssd_efficientdet_d0_512x512 in that case. All the steps followed were the same as in this tutorial: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html. This tutorial is followed by almost all tutors with no issue, but I'm still running the same error with not sufficient solutions on the internet.

4. Expected behavior

Getting the model trained on the custom dataset so that it can be then used for object detection following the next steps.

5. Additional context

2021-03-19 14:57:12.909540: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll Traceback (most recent call last): File "model_main_tf2.py", line 32, in <module> from object_detection import model_lib_v2 File ".\Anaconda3\envs\tf_2.3.0\lib\site-packages\object_detection\model_lib_v2.py", line 29, in <module> from object_detection import eval_util File ".\Anaconda3\envs\tf_2.3.0\lib\site-packages\object_detection\eval_util.py", line 36, in <module> from object_detection.metrics import lvis_evaluation File ".\Anaconda3\envs\tf_2.3.0\lib\site-packages\object_detection\metrics\lvis_evaluation.py", line 23, in <module> from lvis import results as lvis_results File ".\Anaconda3\envs\tf_2.3.0\lib\site-packages\lvis-0.5.3-py3.8.egg\lvis\__init__.py", line 5, in <module> from lvis.vis import LVISVis File ".\Anaconda3\envs\tf_2.3.0\lib\site-packages\lvis-0.5.3-py3.8.egg\lvis\vis.py", line 1, in <module> import cv2 File ".\Anaconda3\envs\tf_2.3.0\lib\site-packages\cv2\__init__.py", line 5, in <module> from .cv2 import * ImportError: DLL load failed while importing cv2: Not enough memory resources are available to process this command.

6. System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • Mobile device name if the issue happens on a mobile device:
  • TensorFlow installed from (source or binary):
  • TensorFlow version (use command below): tensorflow-2.3.0
  • Python version: 3.8
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: 10.1/7.6
  • GPU model and memory: NVIDIA Quadro P520 8GB

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.