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

demo.py测试图片时,每张图片都很耗时,怎么解决。。。 #366

Open
lmw0320 opened this issue Aug 26, 2020 · 6 comments
Open

Comments

@lmw0320
Copy link

lmw0320 commented Aug 26, 2020

我看demo的预测代码中,对每张图片都进行遍历,loadmodel来检测,这样每次都很耗时。。。不知道有什么好办法解决么。。

@lmw0320
Copy link
Author

lmw0320 commented Aug 26, 2020

我查看了下,GPU占用很大(即使只有一张图片进行检测)。同时我为了确保GPU的使用,特地增加了如下代码,结果却无法正常检测:
if tf.test.is_gpu_available(): #如果GPU可用,则指定一块GPU加速 os.environ["CUDA_VISIBLE_DEVICES"] = "0" #指定第一块GPU可用 config = tf.compat.v1.ConfigProto() config.gpu_options.per_process_gpu_memory_fraction = 0.9 # 程序最多只能占用指定gpu90%的显存 config.gpu_options.allow_growth = True #不全部占满显存, 按需分配 sess = tf.compat.v1.Session(config=config) K.set_session(sess)
搞不懂几点:

  1. 为什么一张张图片进行检测,也会占用如此大的GPU资源?
  2. 既然使用了GPU资源,为什么每张图片的检测还是如此耗时?

@lmw0320
Copy link
Author

lmw0320 commented Aug 26, 2020

2
1

@lmw0320
Copy link
Author

lmw0320 commented Aug 26, 2020

@YCG09

@Cocoalate
Copy link

同问啊,测了一下是K.get_value(K.ctc_decode ...)这个地方 一张图片可能都需要1秒左右了

@bai-0829
Copy link

有没有大佬能解答一下呀,测试一张图片,现存占满了,直接就卡在这里不动了

@suoixnazx
Copy link

有没有大佬能解答一下呀,测试一张图片,现存占满了,直接就卡在这里不动了

请问你解决了吗?

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

4 participants