def main(): fnet = SiameseFaceNet() model_dir_path = './models' image_dir_path = "./data/images" fnet.load_model(model_dir_path) database = dict() database["danielle"] = [fnet.img_to_encoding(image_dir_path + "/danielle.png")] database["younes"] = [fnet.img_to_encoding(image_dir_path + "/younes.jpg")] database["tian"] = [fnet.img_to_encoding(image_dir_path + "/tian.jpg")] database["andrew"] = [fnet.img_to_encoding(image_dir_path + "/andrew.jpg")] database["kian"] = [fnet.img_to_encoding(image_dir_path + "/kian.jpg")] database["dan"] = [fnet.img_to_encoding(image_dir_path + "/dan.jpg")] database["sebastiano"] = [fnet.img_to_encoding(image_dir_path + "/sebastiano.jpg")] database["bertrand"] = [fnet.img_to_encoding(image_dir_path + "/bertrand.jpg")] database["kevin"] = [fnet.img_to_encoding(image_dir_path + "/kevin.jpg")] database["felix"] = [fnet.img_to_encoding(image_dir_path + "/felix.jpg")] database["benoit"] = [fnet.img_to_encoding(image_dir_path + "/benoit.jpg")] database["arnaud"] = [fnet.img_to_encoding(image_dir_path + "/arnaud.jpg")] database["deepak"] = [fnet.img_to_encoding(image_dir_path + "/deepak.jpg")] database["momo"] = [fnet.img_to_encoding(image_dir_path + "/momo.jpg")] fnet.verify(image_dir_path + "/camera_0.jpg", "younes", database) fnet.verify(image_dir_path + "/camera_2.jpg", "kian", database) # fnet.verify(image_dir_path + "/test_deepak_1.jpg", "deepak", database) # fnet.verify(image_dir_path + "/test_momo_1.jpg", "momo", database) # fnet.verify(image_dir_path + "/test_momo.jpg", "deepak", database) fnet.who_is_it(image_dir_path + "/camera_0.jpg", database) fnet.who_is_it(image_dir_path + "/younes.jpg", database)
def predict(self, database): fnet = SiameseFaceNet() model_dir_path = './models_1' image_dir_path = "./data/images" fnet.load_model(model_dir_path) print("-------------------------") # fnet.verify(image_dir_path + "/001.png", "aipengfei", database) # fnet.verify(image_dir_path + "/002.png", "aipengfei", database) # fnet.who_is_it(image_dir_path + "/001.png", database) #fnet.who_is_it(image_dir_path + "/002.png", database) fnet.who_is_it("data/5test.jpg", database)
def main(): fnet = SiameseFaceNet() model_dir_path = './model' image_dir_path = "./data/test/align" fnet.load_model(model_dir_path) database1 = dict() #dictionary #fnet.who_is_it(image_dir_path + "/younes.jpg", database) database1["chenaifang"] = [ fnet.img_to_encoding(image_dir_path + "/bailu1.jpg") ] fnet.verify(image_dir_path + "/wangtiange1.jpg", "chenaifang", database1)
def predict(self): fnet = SiameseFaceNet() model_dir_path = './models_1' image_dir_path = "./data/images" fnet.load_model(model_dir_path) database = dict() database["aipengfei"] = [fnet.img_to_encoding(image_dir_path + "/aipengfei.png")] database["anyaru"] = [fnet.img_to_encoding(image_dir_path + "/anyaru.png")] database["baozhiqian"] = [fnet.img_to_encoding(image_dir_path + "/baozhiqian.png")] print("-------------------------") fnet.verify(image_dir_path + "/001.png", "aipengfei", database) fnet.verify(image_dir_path + "/002.png", "aipengfei", database) fnet.who_is_it(image_dir_path + "/001.png", database) fnet.who_is_it(image_dir_path + "/002.png", database) fnet.who_is_it(image_dir_path + "/003.png", database)
def fileName(self): fnet = SiameseFaceNet() model_dir_path = './models_1' image_dir_path = "./data/images" fnet.load_model(model_dir_path) database = dict() rootdir = 'data/stu' list = os.listdir(rootdir) # 列出文件夹下所有的目录与文件 for i in range(0, len(list)): path = rootdir + "/" + list[i] listname = os.listdir(path) for i in range(0, len(listname)): print(path + '/' + listname[i]) database[listname[i].split('.')[0]] = [ fnet.img_to_encoding(path + '/' + listname[i]) ] #print (path+'/'+listname[i]) return database
def fileName(self): fnet = SiameseFaceNet() model_dir_path = './models_2' fnet.load_model(model_dir_path) database = dict() rootdir = 'data/stu100' list = os.listdir(rootdir) # 列出文件夹下所有的目录与文件 for index in range(0, len(list)): path = rootdir+"/"+list[index] listname = os.listdir(path) for i in range(0, len(listname)): print(path+'/'+listname[i]) database[list[index]] = [fnet.img_to_encoding(path+'/'+listname[i])] #print (path+'/'+listname[i]) output = open('myfile.pkl', 'wb') pickle.dump(database, output) output.close() return database
def predict(self,database): fnet = SiameseFaceNet() model_dir_path = './models_2' fnet.load_model(model_dir_path) print("-------------------------") # fnet.verify(image_dir_path + "/001.png", "aipengfei", database) # fnet.verify(image_dir_path + "/002.png", "aipengfei", database) # fnet.who_is_it(image_dir_path + "/001.png", database) #fnet.who_is_it(image_dir_path + "/002.png", database) fnet.who_is_it("data/test/chencongcong.png", database) fnet.who_is_it("data/test/chendandan.png", database) # fnet.who_is_it("data/test/chendaocheng.png", database) # fnet.who_is_it("data/test/chenfuyuan.png", database) # fnet.who_is_it("data/test/chenge.png", database) # fnet.who_is_it("data/test/chenguang.png", database) # fnet.who_is_it("data/test/chenguangwei.png", database) # fnet.who_is_it("data/test/chenguoyan.png", database) # fnet.who_is_it("data/test/chenhaiyan.png", database) # fnet.who_is_it("data/test/chenhao.png", database)