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