message_locations = [ [os.path.join(dataset_folder), 'SAMPLE_fight_detection'], [os.path.join(dataset_folder), 'SAMPLE_crowd_density_local'], [os.path.join(dataset_folder), 'SAMPLE_flow'], [os.path.join(dataset_folder), 'SAMPLE_action_recognition'], [os.path.join(dataset_folder), 'SAMPLE_object_detection'], [os.path.join(dataset_folder), 'SAMPLE_gate_counting'], ] num_algorithms = len(message_locations) time_interval = (algorithm_process_time * num_cameras) / (num_algorithms * num_cameras) time_interval = 5 print('Messages will be sent every {} seconds'.format(time_interval)) configs = [ tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'DOM_101'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'DOM_102'), ] def call_sfn(payload, n, module): # UPDATE URLS AND CHECK LINKSMART try: r = requests.put(url + 'message', json=json.dumps(payload)) except requests.exceptions.RequestException as exception: print('[INFO] Thread {} MODULE {} Failed:{}.'.format( n, module, exception)) else: print('[INFO] Thread {} MODULE {} OK.'.format(n, module))
def register(): print(str(socket.gethostname())) print(KU_DIR) url = 'http://0.0.0.0:5000/' # url = 'http://MPCLSGESFN01.monica-cloud.eu:5000/' # scral_url = 'http://192.168.99.142:8000/' scral_url = 'http://monappdwp3.monica-cloud.eu:8340/scral/v1.0/' # scral_url = 'http://0.0.0.0:3389/' sfn_urls = { 'scral_url': scral_url, 'crowd_density_url': scral_url + 'sfn/camera', 'crowd_density_global_url': scral_url + 'sfn/crowd-density-global', 'flow_analysis_url': scral_url + 'sfn/camera', 'object_detection_url': scral_url + 'sfn/camera', 'fighting_detection_url': scral_url + 'sfn/camera', 'action_recognition_url': scral_url + 'sfn/camera', 'camera_reg_url': scral_url + 'sfn/camera', } configs = [ tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_25'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_26'), ] # HELLO WORLD print('CHECKING CONNECTION TO THE SFN') try: resp = requests.get(url) except requests.exceptions.RequestException as e: print('WOO THERE, Something went wrong, error:' + str(e)) else: print(resp.text, resp.status_code) # RELOAD SETTINGS print('CHECKING SETTINGS RELOAD ON SFN') try: resp = requests.get(url + 'settings') except requests.exceptions.RequestException as e: print('WOO THERE, Something went wrong, error:' + str(e)) else: print(resp.text, resp.status_code) # UPDATE URLS print('CHECKING URL UPDATE SFN') try: resp = requests.post(url + 'urls', json=json.dumps(sfn_urls)) except requests.exceptions.RequestException as e: print('WOO THERE, Something went wrong, error:' + str(e)) else: print(resp.text, resp.status_code) # SEND THE CONFIGS AS IF VCA WERE UPDATING THE SFN print('CHECKING CONFIG UPDATE SFN') try: resp = requests.post(url + 'configs', json=json.dumps(configs)) except requests.exceptions.RequestException as e: print('WOO THERE, Something went wrong, error:' + str(e)) else: print(resp.text, resp.status_code)
scral_url = 'http://monappdwp3.monica-cloud.eu:8000/' # scral_url = 'http://0.0.0.0:3389/' sfn_urls = { 'scral_url': scral_url, 'crowd_density_url': scral_url + 'sfn/camera', 'crowd_density_global_url': scral_url + 'sfn/crowd_density_global', 'flow_analysis_url': scral_url + 'sfn/camera', 'object_detection_url': scral_url + 'sfn/camera', 'fighting_detection_url': scral_url + 'sfn/camera', 'action_recognition_url': scral_url + 'sfn/camera', 'camera_reg_url': scral_url + 'sfn/camera', } configs = [ tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'MOVIDA_124'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'MOVIDA_125'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'MOVIDA_126'), ] # HELLO WORLD print('CHECKING CONNECTION TO THE SFN') try: resp = requests.get(url) except requests.exceptions.RequestException as e: print('WOO THERE, Something went wrong, error:' + str(e)) else: print(resp.text, resp.status_code)
[ os.path.join(dataset_folder), '0000010_LEEDS_4_435ae19f-0eab-5561-b11a-9ead485180d6_crowd_density_local' ], [ os.path.join(dataset_folder), '0000018_LEEDS_3_435ae19f-0eab-5561-b11a-9ead485180d6_crowd_density_local' ], [ os.path.join(dataset_folder), '0000015_LEEDS_1_435ae19f-0eab-5561-b11a-9ead485180d6_crowd_density_local' ], ] configs = [ tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'LEEDS_1'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'LEEDS_2'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'LEEDS_3'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'LEEDS_4'), ] def call_sfn(payload, n, module): # UPDATE URLS AND CHECK LINKSMART try: r = requests.put(url + 'message', json=json.dumps(payload)) except requests.exceptions.RequestException as exception: print('[INFO] Thread {} MODULE {} Failed:{}.'.format(
f = cv2.imread(file_name + '_frame.jpeg') frame = cv2.imread(file_name + '_frame.jpeg') # density = cv2.imread(file_name + '_density.jpeg') # settings_location = dataset_folder + 'CONFIG/ORIGINAL/' # config = tools.load_settings(settings_location, message['camera_ids'][0]) # cv2.rectangle(f, (5, 5), (375, 60), blk, -1) # cv2.putText(f, 'Camera Name: {}'.format(message['camera_ids'][0]), (5, 20), font, 0.5, wht, 1, cv2.LINE_AA) # cv2.putText(f, 'Number of People: {}'.format(message['density_count']), (5, 35), font, 0.5, wht, 1, cv2.LINE_AA) # cv2.putText(f, 'Time: {}'.format(message['timestamp_1']), (5, 50), font, 0.5, wht, 1, cv2.LINE_AA) # # key = cv2.waitKey(1) & 0xFF # cv2.imshow('frame', frame) # cv2.imwrite(os.path.join(save_folder, os.path.split(file_name)[1] + '_frame.jpeg'), f) config = tools.load_settings(settings_folder, message['camera_ids'][0]) # message, result = analyser.process_frame(frame, config['camera_id'], config['crowd_mask'], # config['image_2_ground_plane_matrix'], # config['ground_plane_roi'], # config['ground_plane_size']) # message = json.loads(message) mask = cv2.resize(np.array(config['crowd_mask']), (frame.shape[1], frame.shape[0])) mask[mask > 0] = 1 t_frame = (frame * ((np.dstack( (mask, mask, mask)) + 1) * 0.5)).astype(np.uint8) cv2.rectangle(t_frame, (5, 5), (375, 60), blk, -1) cv2.putText(t_frame, 'Camera Name: {}'.format(message['camera_ids'][0]), (5, 20), font, 0.5, wht, 1, cv2.LINE_AA)
message_locations = [ [os.path.join(dataset_folder), 'SAMPLE_fight_detection'], [os.path.join(dataset_folder), 'SAMPLE_crowd_density_local'], [os.path.join(dataset_folder), 'SAMPLE_flow'], [os.path.join(dataset_folder), 'SAMPLE_action_recognition'], [os.path.join(dataset_folder), 'SAMPLE_object_detection'], ] num_algorithms = len(message_locations) time_interval = (algorithm_process_time * num_cameras) / (num_algorithms * num_cameras) time_interval = 5 print('Messages will be sent every {} seconds'.format(time_interval)) configs = [ tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_25'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_26'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_27'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_28'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_29'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_30'), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/cam_configs/'), 'TIVOLI_31'), ]
# url = 'http://MPCLSGESFN01.monica-cloud.eu:5000/' scral_url = 'http://monappdwp3.monica-cloud.eu:8000/' # scral_url = 'http://0.0.0.0:3389/' sfn_urls = { 'scral_url': scral_url, 'crowd_density_url': scral_url + 'sfn/crowd_monitoring', 'flow_analysis_url': scral_url + 'sfn/flow_analysis', 'object_detection_url': scral_url + 'sfn/object_detection', 'fighting_detection_url': scral_url + 'sfn/fight_detection', 'action_recognition_url': scral_url + 'sfn/action_recognition', 'camera_reg_url': scral_url + 'sfn/camera', } configs = [ tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '175_reg', False), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '176_reg', False), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '177_reg', False), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '178_reg', False), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '180_reg', False), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '182_reg', False), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '183_reg', False), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '184_reg', False), tools.load_settings(os.path.join(KU_DIR, 'KUConfigTool/'), '189_reg',