代码拉取完成,页面将自动刷新
同步操作将从 Submitk/ 人脸识别 Face recognition 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import os
import csv
def create_newcsv(path):
with open(path, "w+", newline='') as file:
csv_file = csv.writer(file)
def create_csv(path):
with open(path, "w+", newline='') as file:
csv_file = csv.writer(file)
head = ["student_ID","name","sex","age","class","time"]
csv_file.writerow(head)
def append_csv(path,datas):
with open(path, "a+", newline='') as file:
csv_file = csv.writer(file)
#datas = [["hoojjack3", "boy3"]]
csv_file.writerows(datas)
def read_csv(path):
with open(path,"r+") as file:
csv_file = csv.reader(file)
for data in csv_file:
print("data:", data)
print(data[0])
read_csv('face.csv')
def read_csv_id(path,id):
with open(path,"r+") as file:
csv_file = csv.reader(file)
for data in csv_file:
# print("datas:", data)
if data[0]==id:
return data
print(read_csv_id('face.csv','111111'))
def read_csv_studentid(path):
with open(path,"r+") as file:
csv_file = csv.reader(file)
for data in csv_file:
# print("datas:", data)
return data[0]
############################################
# 函数名:read_max_id #
# 输入:图片的位置path #
# 返回值:最大的编号id_max #
# 作用:获取人脸数据最大编号 #
############################################
def read_max_id(path):
id_max = -1
image_paths = [os.path.join(path, f) for f in os.listdir(path)]
for image_path in image_paths:
if os.path.split(image_path)[-1].split(".")[-1] != 'jpg':
continue #查找jpg结尾的图
image_id = int(os.path.split(image_path)[-1].split(".")[1])
id = image_id
if id_max < id:
id_max = id
else:
continue
return id_max
############################################
# 函数名:del_file #
# 输入:图片的位置path #
# 返回值:无 #
# 作用:递归删除所有人脸数据 #
############################################
def del_file(path):
ls = os.listdir(path)
for i in ls:
c_path = os.path.join(path, i)
if os.path.isdir(c_path):
del_file(c_path)
else:
os.remove(c_path)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。