mirror of
				https://github.com/PaddlePaddle/FastDeploy.git
				synced 2025-10-31 03:46:40 +08:00 
			
		
		
		
	 e7c6a9d346
			
		
	
	e7c6a9d346
	
	
	
		
			
			* first commit for yolov7 * pybind for yolov7 * CPP README.md * CPP README.md * modified yolov7.cc * README.md * python file modify * delete license in fastdeploy/ * repush the conflict part * README.md modified * README.md modified * file path modified * file path modified * file path modified * file path modified * file path modified * README modified * README modified * move some helpers to private * add examples for yolov7 * api.md modified * api.md modified * api.md modified * YOLOv7 * yolov7 release link * yolov7 release link * yolov7 release link * copyright * change some helpers to private * change variables to const and fix documents.
		
			
				
	
	
		
			22 lines
		
	
	
		
			566 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			566 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import fastdeploy as fd
 | |
| import cv2
 | |
| 
 | |
| # 下载模型和测试图片
 | |
| test_jpg_url = "https://raw.githubusercontent.com/WongKinYiu/yolov7/main/inference/images/horses.jpg"
 | |
| fd.download(test_jpg_url, ".", show_progress=True)
 | |
| 
 | |
| # 加载模型
 | |
| model = fd.vision.wongkinyiu.YOLOv7("yolov7.onnx")
 | |
| 
 | |
| # 预测图片
 | |
| im = cv2.imread("horses.jpg")
 | |
| result = model.predict(im, conf_threshold=0.25, nms_iou_threshold=0.5)
 | |
| 
 | |
| # 可视化结果
 | |
| fd.vision.visualize.vis_detection(im, result)
 | |
| cv2.imwrite("vis_result.jpg", im)
 | |
| 
 | |
| # 输出预测结果
 | |
| print(result)
 | |
| print(model.runtime_option)
 |