pytorch 多进程读写同一个文件
【摘要】 torch 读写同一个图片
# -*- coding:utf-8 -*-from threading import Thread import bind_cv as demoimport time import torchimport torch.multiprocessing as mp from torch.multiprocessing import Pool, Ma...
torch 读写同一个图片
-
# -*- coding:utf-8 -*-
-
from threading import Thread
-
-
import bind_cv as demo
-
import time
-
-
import torch
-
import torch.multiprocessing as mp
-
-
from torch.multiprocessing import Pool, Manager
-
-
-
import cv2
-
-
-
class VideoLoader(Thread):
-
def __init__(self, name, cam_url,model):
-
super(VideoLoader, self).__init__()
-
self.name = name
-
self.cam_url = cam_url
-
self.index=0
-
self.model=model
-
-
def end_callback(self, type):
-
print("end", type)
-
time.sleep(10)
-
print("play restart")
-
try:
-
binddemo.play_url(self.cam_url, self.m_callback, self.end_callback)
-
except Exception as e:
-
print("连接失败", e)
-
-
def m_callback(self, a, width, height, t1):
-
global start
-
global start2
-
global t2
-
data = a.reshape(height, width, 3)
-
data = cv2.cvtColor(data, cv2.COLOR
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/92759393
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)