环境
.NET Framework 4.6.2 , X64 , VS2022
依赖
OpenCvSharp.dll,OpenCvSharp.Extensions.dll,Microsoft.ML.OnnxRuntime.dll,u2net_human_seg.onnx
效果

页面

全部逻辑代码
    public partial class Form1 : Form
    {
        private string imgFile = "";  
        private string model_path = string.Empty;
        private int modelSize = 0;
        private SessionOptions options = null;
        private InferenceSession onnx_session = null;
        private List<NamedOnnxValue> input_ontainer = null;
        private DenseTensor<float> input_tensor = null;
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter = "图像文件|*.jpg;*.png;";
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    imgFile = ofd.FileName;
                }
            }
            if (string.IsNullOrEmpty(imgFile))
            {
                return;
            }
            do_rec();
        }
        private async void do_rec()
        {
            var imgBs = File.ReadAllBytes(imgFile);
            var imgInit = Image.FromStream(new MemoryStream(imgBs)) as Bi
 
                   
                   
                   
                   最低0.47元/天 解锁文章
最低0.47元/天 解锁文章
                           
                       
       
           
                 
                 
                 
                 
                 
                
               
                 
                 
                 
                 
                
               
                 
                 扫一扫
扫一扫
                     
              
             
                   920
					920
					
 被折叠的  条评论
		 为什么被折叠?
被折叠的  条评论
		 为什么被折叠?
		 
		  到【灌水乐园】发言
到【灌水乐园】发言                                
		 
		 
    
   
    
   
             
            


 
            