def __init__(self,ori_dataset): self.col = [] self.ld = ori_dataset self.dataset = ori_dataset.dataset self.ins = Inspection(self.dataset) self.head = ori_dataset.head self.label = self.ld.get_value(self.dataset,-1)
def get_inspections(): inspections = [] with open("data.csv") as file: reader = csv.reader(file, delimiter=",") # Skip header. next(reader) for index, line in enumerate(reader): inspections.append( Inspection( restaurant_id=line[0], restaurant_name=line[1], borough=line[2], zipcode=line[5], cusine=line[7], inspection_date=line[8], violation_code=line[10], violation_description=line[11], score=line[13], grade=line[14], grade_date=line[15], ), ) return inspections
def __init__(self): threading.Thread.__init__(self) self.setting_json = gParam.Setting_Json self.videosplit_path = gParam.VideoSplit_Path self.face_path = gParam.Face_Path self.face_db = gParam.FaceDB_Path self.faceclipxml_path = gParam.FaceClipXml_Path # 以下这3个数据在一次StartIdentify事件或Sync之后要全部更新 # face_datas中保存数据库中所有员工的信息列表,包括人脸特征 # self.face_datas = features_abstract() # face_datas_flags是用来看有没有多次识别 # self.face_datas_flags = [0]*len(self.face_datas) # person_num保存识别出员工的工号 self.person_num = [] # 本次识别的各种设定 self.time_limit = 5 self.period = 1 self.TaskID = 'TaskID' self.PersonCount = 1 self.rq = redis.Redis(host='127.0.0.1', port=6379) # 下面的是之前写的,应该不起作用 with open(gParam.Client_Server_Cfg, 'r') as f: configuration = json.loads(f.read()) # print('客户端与服务端TCP连接配置如下', configuration) self.ins = Inspection(configuration['REDIS_HOST'])
def __init__(self, ori_dataset, max_depth): self.col = [] self.max_depth = max_depth self.dataset = ori_dataset self.ld = LoadData() self.ins = Inspection(ori_dataset)
def __init__(self,col_index_used,col_index_touse, dataset, head, left = None, right = None, depth=0): self.left = left self.right = right self.message = '' self.col_index_touse = col_index_touse self.col_index_used = col_index_used self.attribute = head[col_index_used] # the attribute to divide self.dataset = dataset # the dataset divided by attribute self.depth = depth # current depth of the node self.ld = LoadData() self.ins = Inspection(self.dataset) self.result = self.ins.majority_vote(dataset) # majority_vote for each node
print('客户端与服务端TCP连接配置如下', configuration) # redis 连接池 pool = redis.ConnectionPool(host=configuration['REDIS_HOST'], port=6379, decode_responses=True) r = redis.Redis(connection_pool=pool) # 与服务端连接的配置 ADDR = (configuration['IP'], configuration['PORT']) tctimeClient = socket(AF_INET, SOCK_STREAM) tctimeClient.bind((configuration['LOCAL_IP'], 5678)) tctimeClient.connect(ADDR) BUFFSIZE = configuration['BUFFSIZE'] ins = Inspection(configuration['REDIS_HOST']) def heartbeat(): """心跳检测函数,根据configuration.txt中设置的间隔时间固定发出心跳检测,确认连接情况 """ while True: try: print('===============heartbeat start============') print('heart jinru 1') heartbeat = ins.register() tctimeClient.send(heartbeat.encode()) print('done') ret_data = tctimeClient.recv(BUFFSIZE).decode() print('rt_register', ret_data) # tctimeClient.close()
v_cap.video = '1.mp4' t_helmet.start() v_cap.start() f_dectect.start() setdefaulttimeout(10) pool = redis.ConnectionPool(host='127.0.0.1', port=6379, decode_respomses=True) r = redis.Redis(connection_pool=pool) ADDR = ('23.88.228.11', 43967) tctimeClient = socket(AF_INET, SOCK_STREAM) tctimeClient.connect(ADDR) BUFFSIZE = 20480000 ins = Inspection('127.0.0.1') def main(): event = Event(e_smoking=True) event.TaskID = '4396' event.start() t_send = NewThread('Event', '4396', 4, tctimeClient) v_cap.video_path = gParam.Video_Path v_cap.video = 'smoking.mp4' setting(status='run', writing=True) setting(address=gParam.Event_Setting_Json, status='run', writing=True) t_send.start()