def run_validate_images(validated_image_list, graph, index, testOutputList, testOutputFileList): for validated_image_filename in validated_image_list: validated_image = cv2.imread(VALIDATED_IMAGES_DIR + validated_image_filename) valid_output_full = run_inference(validated_image, graph, validated_image_filename) valid_output = rmsList(valid_output_full, 13) #print("valid_output=",valid_output) validTupl = toRecTuple(valid_output) #print("validTuble=",validTupl) hits = list(index.nearest(validTupl, objects=True)) hitsId = [str(item.id) + " -- " + item.object for item in hits] for h in hitsId: print("R-tree for: " + validated_image_filename + ' matches ' + h) # Test the inference results of this image with the results # from the known valid face. idx_nr = 0 for test_output_full in testOutputList: (fm, fmdiff) = face_match(valid_output_full, test_output_full) if (fm): print('PASS! test ' + validated_image_filename + ' matches ' + testOutputFileList[idx_nr] + ' id=' + str(idx_nr) + ' diff=' + str(fmdiff)) idx_nr = idx_nr + 1
def search_index(index, validTupl, validated_image_filename): nearHits = list(index.nearest(validTupl, objects=True)) nearHitsId = [str(item.id) + " -- " + item.object for item in nearHits] for h in nearHitsId: print("R-tree near for: " + validated_image_filename + ' matches ' + h) intrHits = list(index.intersection(validTupl, objects=True)) intrHitsId = [str(item.id) + " -- " + item.object for item in intrHits] for h in intrHitsId: print("R-tree intersect for: " + validated_image_filename + ' matches ' + h)
def run_validate_images(validated_image_list, graph, index, testOutputList): for validated_image_filename in validated_image_list: validated_image = cv2.imread(VALIDATED_IMAGES_DIR + validated_image_filename) valid_output_full = run_inference(validated_image, graph, validated_image_filename) valid_output = rmsList(valid_output_full, 13) #print("valid_output=",valid_output) validTupl = toRecTuple(valid_output) #print("validTuble=",validTupl) a = list(index.nearest(validTupl)) print("R-tree near: ", a) # Test the inference results of this image with the results # from the known valid face. idx_nr = 0 for test_output_full in testOutputList: if (face_match(valid_output_full, test_output_full)): print('PASS! idx ' + str(idx_nr) + ' matches ' + validated_image_filename) idx_nr = idx_nr + 1