def jsonAppend(fileNM, name): rc = -1 try: if GLOB.fileExist(fileNM): with open(fileNM, 'a', encoding='utf-8') as f: data = ', {"DOOR_OPEN_TIME" : "%s", "NAME" : "%s" }' % ( COM.gstrYMDHMS, name) f.write(data) else: with open(fileNM, 'w', encoding='utf-8') as f: data = '{"DOOR_OPEN_TIME" : "%s", "NAME" : "%s" }' % ( COM.gstrYMDHMS, name) f.write(data) rc = 0 except Exception as e: LOG.writeLn("[jsonAppend ERROR]: %s" % e) return rc
known_face_names = [] known_face_encodings = [] for i in file_list: known_face_names.append(os.path.splitext(i)[0]) face_image = face_recognition.load_image_file(path + i) known_face_encodings.append(face_recognition.face_encodings(face_image)[0]) # Initialize some variables face_locations = [] face_encodings = [] face_names = [] process_this_frame = True # Delete json logs if GLOB.fileExist(COM.gJsonDir + "device.json"): os.remove(COM.gJsonDir + "device.json") led_pin = 20 GPIO.setmode(GPIO.BCM) GPIO.setup(led_pin, GPIO.OUT) mLstImgFileSize = 1 aMin = 601 print('') print('--------------------------------------------------') print('** Welcome to FROGMON corp.') print("** Let's make it together") print("** ") print("** face path check : %s" % path)