mirror of
				https://github.com/PaddlePaddle/FastDeploy.git
				synced 2025-10-31 11:56:44 +08:00 
			
		
		
		
	 adddd3c452
			
		
	
	adddd3c452
	
	
	
		
			
			* update .gitignore * Added checking for cmake include dir * fixed missing trt_backend option bug when init from trt * remove un-need data layout and add pre-check for dtype * changed RGB2BRG to BGR2RGB in ppcls model * add model_zoo yolov6 c++/python demo * fixed CMakeLists.txt typos * update yolov6 cpp/README.md * add yolox c++/pybind and model_zoo demo * move some helpers to private * fixed CMakeLists.txt typos * add normalize with alpha and beta * add version notes for yolov5/yolov6/yolox * add copyright to yolov5.cc * revert normalize * fixed some bugs in yolox * Add RetinaFace Model support * fixed retinaface/api.md typos
		
			
				
	
	
		
			25 lines
		
	
	
		
			769 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			769 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import fastdeploy as fd
 | |
| import cv2
 | |
| 
 | |
| # 下载模型
 | |
| model_url = "https://github.com/DefTruth/Pytorch_Retinaface/releases/download/v0.1/Pytorch_RetinaFace_mobile0.25-640-640.onnx"
 | |
| test_img_url = "https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/raw/master/imgs/3.jpg"
 | |
| fd.download(model_url, ".", show_progress=True)
 | |
| fd.download(test_img_url, ".", show_progress=True)
 | |
| 
 | |
| # 加载模型
 | |
| model = fd.vision.biubug6.RetinaFace(
 | |
|     "Pytorch_RetinaFace_mobile0.25-640-640.onnx")
 | |
| 
 | |
| # 预测图片
 | |
| im = cv2.imread("3.jpg")
 | |
| result = model.predict(im, conf_threshold=0.7, nms_iou_threshold=0.3)
 | |
| 
 | |
| # 可视化结果
 | |
| fd.vision.visualize.vis_face_detection(im, result)
 | |
| cv2.imwrite("vis_result.jpg", im)
 | |
| 
 | |
| # 输出预测结果
 | |
| print(result)
 | |
| print(model.runtime_option)
 |