from docs.conf import DB_CONF db = MySQLPlugin(host=DB_CONF['server'], user=DB_CONF['user'], password=DB_CONF['pwd'], db=DB_CONF["db"]) CAMERAS_INFO = db.query_camera_data() # 从数据库获取摄像头info CAMERAS_INFO = { camera_info['cameraID']: camera_info for camera_info in CAMERAS_INFO } cameraID = 119 # camera相关信息和数据 camera_info_and_data = CameraInfoAndData(CAMERAS_INFO[cameraID]) camera_address = camera_info_and_data.url camera_frame_rate = camera_info_and_data.frame_rate camera_rotate = camera_info_and_data.rotate camera_size = camera_info_and_data.size area_info_list = camera_info_and_data.area_info_list frame_data_queue = camera_info_and_data.frame_data_queue # 图像帧队列 # 开始process processes = [ mp.Process(target=track_and_show, args=(cameraID, camera_address, camera_rotate)) # 追踪进程 ] [process.start() for process in processes] [process.join() for process in processes]
db = MySQLPlugin(host=DB_CONF['server'], user=DB_CONF['user'], password=DB_CONF['pwd'], db=DB_CONF["db"]) CAMERAS_INFO = db.query_camera_data() # 从数据库获取摄像头info CAMERAS_INFO = { camera_info['cameraID']: camera_info for camera_info in CAMERAS_INFO } cameraID_list = [105, 108, 107, 106] # 106,107, 108, 105 areaID_list = [] CAMERA_NUM = len(cameraID_list) camera_dict = {} # key:cameraID, value:camera相关信息和数据 for cameraID in cameraID_list: camera_dict[cameraID] = CameraInfoAndData(CAMERAS_INFO[cameraID]) for cameraID in camera_dict: area_info_list = camera_dict[cameraID].area_info_list for area_info in area_info_list: areaID_list.append(area_info[0]) areaID_list = list(set(areaID_list)) print('cameraID_list', cameraID_list) print('areaID_list', areaID_list) GPU_NUM = 1 CAMERA_NUM_PER_GPU = math.ceil(CAMERA_NUM / GPU_NUM) # 所有进程队列 ProcessList = [] batch_data_queue = mp.Queue(5)