Skip to content

Commit

Permalink
modified: Facial.Data.Extractor.Multifile.spec
Browse files Browse the repository at this point in the history
	modified:   Facial.Data.Extractor.Singlefile.spec
	modified:   Launcher.py
	modified:   VersionInfo.json
	modified:   src/Extractor.py
	modified:   src/Processor.py
	modified:   src/VersionChecker.py
	new file:   src/models/hrnet_eyes.onnx
	new file:   src/models/hrnet_face.onnx
  • Loading branch information
ChasonJiang committed Jul 16, 2023
1 parent 15b0c44 commit ba86bf6
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Facial.Data.Extractor.Multifile.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ a = Analysis(
pathex=[],
binaries=[],
datas=[("C:\\Users\\14404\\.virtualenvs\\Extractor-PieuWTZ6\\Lib\\site-packages\\onnxruntime\\capi","onnxruntime\\capi"),
("src\\models\\resnet50_face.onnx","src\\models"),
("src\\models\\resnet50_eyes.onnx","src\\models"),
("src\\models\\hrnet_face.onnx","src\\models"),
("src\\models\\hrnet_eyes.onnx","src\\models"),
("C:\\Users\\14404\\.virtualenvs\\Extractor-PieuWTZ6\\Lib\\site-packages\\\mtcnn_ort\\onet.onnx","mtcnn_ort"),
("C:\\Users\\14404\\.virtualenvs\\Extractor-PieuWTZ6\\Lib\\site-packages\\\mtcnn_ort\\pnet.onnx","mtcnn_ort"),
("C:\\Users\\14404\\.virtualenvs\\Extractor-PieuWTZ6\\Lib\\site-packages\\\mtcnn_ort\\rnet.onnx","mtcnn_ort")
Expand Down
4 changes: 2 additions & 2 deletions Facial.Data.Extractor.Singlefile.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ a = Analysis(
pathex=[],
binaries=[],
datas=[("C:\\Users\\14404\\.virtualenvs\\Extractor-PieuWTZ6\\Lib\\site-packages\\onnxruntime\\capi","onnxruntime\\capi"),
("src\\models\\resnet50_face.onnx","src\\models"),
("src\\models\\resnet50_eyes.onnx","src\\models"),
("src\\models\\hrnet_face.onnx","src\\models"),
("src\\models\\hrnet_eyes.onnx","src\\models"),
("C:\\Users\\14404\\.virtualenvs\\Extractor-PieuWTZ6\\Lib\\site-packages\\\mtcnn_ort\\onet.onnx","mtcnn_ort"),
("C:\\Users\\14404\\.virtualenvs\\Extractor-PieuWTZ6\\Lib\\site-packages\\\mtcnn_ort\\pnet.onnx","mtcnn_ort"),
("C:\\Users\\14404\\.virtualenvs\\Extractor-PieuWTZ6\\Lib\\site-packages\\\mtcnn_ort\\rnet.onnx","mtcnn_ort")
Expand Down
1 change: 0 additions & 1 deletion Launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
app=QApplication(sys.argv)
extractorWindow=ExtractorWindow()
extractorWindow.show()

sys.exit(app.exec())
4 changes: 2 additions & 2 deletions VersionInfo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version":"1.2.0",
"UpdateInfo":"1. 新增了人脸检测模型;\n2. 新增了人脸自动裁切功能;\n3. 改进了提取流程;\n4. 优化了面部数据模型;\n5. 新增了多文件版本,以改进软件启动速度。\n",
"Version":"1.2.1",
"UpdateInfo":"1.更新了面部数据提取模型;\n2.改进了面部和眼部的特征相似度;3.建议更新!",
"Download":{
"Github":"https://github.com/ChasonJiang/Facial-Data-Extractor/releases/latest",
"BaiduNetDisk":"https://pan.baidu.com/s/1WSTzlX6bLuRahuxxDQih3A?pwd=fhuz"
Expand Down
8 changes: 5 additions & 3 deletions src/Extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def initConfig(self):
# to extract on "cpu" or "cuda"(gpu)
# self.device = torch.device("cuda")
# string.saveing path of model
self.face_model_load_path = "models/resnet50_face.onnx"
self.eyes_model_load_path = "models/resnet50_eyes.onnx"
self.face_model_load_path = "models/hrnet_face.onnx"
self.eyes_model_load_path = "models/hrnet_eyes.onnx"
# self.model_load_path = "models/last_head_1_34_30_with_colorjitter.pth"
# tuple. resize image to the shape. The aspect ratio should be 9:16
# self.im_size = (252, 352)
Expand Down Expand Up @@ -60,7 +60,9 @@ def extract(self,filename:str,savepath:str,weight:list[float] = [0.5,0.5]):
raise Exception("检测到多张人脸,请更换提取图片!")

face = self.transforms(faces[0])
eyes = face[:,:,35:70,...]
# eyes = face[:,:,35:70,...]
eyes = np.zeros_like(face)
eyes[:,:,35:70,...] = face[:,:,35:70,...]

try:
face_output:np.ndarray=self.face_model_ort.run(['out'], {'in': face})[0].squeeze(0)
Expand Down
2 changes: 1 addition & 1 deletion src/Processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run(self):
# self.log_signal.emit("Extractor 加载成功!\n")
self.log_signal.emit(f"正在提取,请稍等...\n")
try:
self.extractor.extract(self.img_path,self.save_path)
self.extractor.extract(self.img_path,self.save_path, weight=[0.2,0.8])
except Exception as e:
self.log_signal.emit(f"提取失败!\n")
self.log_signal.emit(traceback.format_exc())
Expand Down
17 changes: 8 additions & 9 deletions src/VersionChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ def run(self):
headers={
"Content-Type":"'text/html; charset=utf-8'"
}
# try:
# url = "https://raw.githubusercontent.com/ChasonJiang/Facial-Data-Extractor/main/VersionInfo.json"
# res = requests.get(url,headers=headers,verify=False)
# except:
# self.result_signal.emit({"State":False,"msg":"网络异常,版本获取信息失败!\n"})
# return


try:
url = "http://106.52.148.60:14406/facial_data_extrator/update"
res = requests.get(url,headers=headers,verify=False)
except:
self.result_signal.emit({"State":False,"msg":"网络异常,版本获取信息失败!\n"})
return
try:
url = "https://raw.githubusercontent.com/ChasonJiang/Facial-Data-Extractor/main/VersionInfo.json"
res = requests.get(url,headers=headers,verify=False)
except:
self.result_signal.emit({"State":False,"msg":"网络异常,版本获取信息失败!\n"})
return


if res.status_code!=200:
self.result_signal.emit({"State":False,"msg":"网络异常,版本获取信息失败!\n"})
Expand Down
Binary file modified src/__pycache__/Extractor.cpython-311.pyc
Binary file not shown.
Binary file modified src/__pycache__/ExtractorWindow.cpython-311.pyc
Binary file not shown.
Binary file modified src/__pycache__/Processor.cpython-311.pyc
Binary file not shown.
Binary file added src/models/hrnet_eyes.onnx
Binary file not shown.
Binary file added src/models/hrnet_face.onnx
Binary file not shown.

0 comments on commit ba86bf6

Please sign in to comment.