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

多线程调用模型进行测试 #46

Open
sunpu1995 opened this issue Jan 18, 2021 · 1 comment
Open

多线程调用模型进行测试 #46

sunpu1995 opened this issue Jan 18, 2021 · 1 comment

Comments

@sunpu1995
Copy link

ValueError: Tensor Tensor("lambda_1/map/TensorArrayStack/TensorArrayGatherV3:0", shape=(?, ?, 6), dtype=float32) is not an element of this graph.

当我使用一下代码进行测试的时候出现这个错误,
hat_cfg = PPYOLO_2x_Config()
hat_detector = PPYOLO_2x_Hat(hat_cfg, use_gpu=True)
video_path = cfg.video_path

def main():
# ----------------------------------------视频处理------------------------------------------
cap = cv2.VideoCapture(video_path)
print('load ' + video_path)
print('---------------------------')
index = 0
while True:
print(index)
ret, frame = cap.read()
if not ret:
break
if index % cfg.sample_interval != 0:
index += 1
continue
_, hat_output_box = hat_detector.detect_image(frame) # 安全帽检测
print(hat_output_box)
index+=1

if name == 'main':
for i in range(3):
threading.Thread(target=main).start()

@miemie2013
Copy link
Owner

不建议多线程里使用模型

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

2 participants