Ejemplo n.º 1
0
# initialize the Adjusted class -> obj_det_custom_yolo_live.py
adj = Adjusted()

if initial.access_path: # not doing the hardcoded test
	try: # allows for a keyboard interrupt
		while(True): # continuously run this code until a keyboard interrupt occurs
			update = 0 # check to see if the AI ran
			if initial.mutex == 1: # check to see if init can access the files
				#print("in mutex 1")
				asyncio.run(initial.look_for_image()) # look for images in the unaccessed folder -> init.py/look_for_image
			if len(initial.queue) > 0:# and initial.mutex == 2: # if there are images to run and AI can access the files
				#print("in mutex 2")
				adj.AIRun(initial.queue[0]) # run the AI on the first image in the queue -> obj_det_custom_yolo_live.py
				#adj.AIRun() # testing purposes only
				initial.queue.pop(0) # remove the image we just ran through the AI
				initial.mutex = 1 # change locks
				update = 1 # make it so we don't try to update the database every time if there is nothing new to add
			if update:
				img_data = initial.get_img_data() # get the updated data
				
				for img in img_data: # for each image in the dictionary, send any new data to the database
					# print(img)
					# the second dictionary has entries separated by bounding box (x, y) coordinates (coordinates in reference to image size, not GPS)
					for box in img_data[img]: # for each bounding box in the image
						#print("box")
						# limit entries sent to database to 5, for testing purposes only (everything will work without this, this is only used for proof of concept)
						#if i > 5:
						#	break
						# there is other information stored in the initial dictionary that is not the second dictionary, we want to skip over this
						#print(type(init.img_data[img][box]))
						#print(init.img_data[img][box])