[C#]winform基于attentive_derain_net深度学习算法进行图像去雨部署实现

【训练源码】

https://github.com/MaybeShewill-CV/attentive-gan-derainnet

【参考源码】

https://github.com/hpc203/attentive-gan-derainnet-onnxruntime

【算法介绍】

主要基于CVPR2018论文“单图像雨滴去除的注意生成对抗网络”,使用tensorflow实现图像去噪任务的深度卷积生成对抗网络。你可以参考他们的论文了解详情https://arxiv.org/abs/1711.10098.该模型由注意力-注意力循环网络、上下文自动编码器网络和判别网络组成。使用卷积lstm单元生成注意力图,用于帮助定位雨滴、多尺度损失和感知损失,以训练上下文自动编码器网络。感谢原始作者Rui Qian

主要网络架构如下:

可以在线体验:

 https://maybeshewill-cv.github.io/attentive_derain_net 

【效果展示】

【部分实现代码】 

using System;
using System.Diagnostics;
using System.Windows.Forms;
using OpenCvSharp;

namespace FIRC
{
    public partial class Form1 : Form
    {
        Mat src = null;
        AGDManager dm = new AGDManager();
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "图文件(*.*)|*.jpg;*.png;*.jpeg;*.bmp";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.Multiselect = false;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
              
                src = Cv2.ImRead(openFileDialog.FileName);
                pictureBox1.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(src);


            }


        }

        private void button2_Click(object sender, EventArgs e)
        {
            if(pictureBox1.Image==null)
            {
                return;
            }
            var resultImg = dm.Inference(src);

            pictureBox2.Image= OpenCvSharp.Extensions.BitmapConverter.ToBitmap(resultImg);



        }
      
          

        private void Form1_Load(object sender, EventArgs e)
        {
            dm.LoadWeights(Application.StartupPath+ "\\weights\\attentive_gan_derainnet_180x320.onnx");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            VideoCapture capture = new VideoCapture(0);
            if (!capture.IsOpened())
            {
                Console.WriteLine("video not open!");
                return;
            }
            Mat frame = new Mat();
            var sw = new Stopwatch();
            int fps = 0;
            while (true)
            {

                capture.Read(frame);
                if (frame.Empty())
                {
                    Console.WriteLine("data is empty!");
                    break;
                }
                sw.Start();
                var resultImg = dm.Inference(frame);
                sw.Stop();
                fps = Convert.ToInt32(1 / sw.Elapsed.TotalSeconds);
                sw.Reset();
            
                Cv2.PutText(resultImg, "FPS=" + fps, new OpenCvSharp.Point(30, 30), HersheyFonts.HersheyComplex, 1.0, new Scalar(255, 0, 0), 3);
                //显示结果
                Cv2.ImShow("Result", resultImg);
                int key = Cv2.WaitKey(10);
                if (key == 27)
                    break;
            }

            capture.Release();
        }
    }
}

测试环境

vs2019

netframework4.7.2

opencvsharp==4.8.0

onnxruntime==1.16.2

【视频演示】 

C#winform基于attentive_derain_net深度学习算法进行图像去雨部署实现_哔哩哔哩_bilibili【测试环境】vs2019netframework4.7.2opencvsharp==4.8.0onnxruntime==1.16.2更多信息参考:https://blog.csdn.net/FL1623863129/article/details/141310889, 视频播放量 2、弹幕量 0、点赞数 0、投硬币枚数 0、收藏人数 0、转发人数 0, 视频作者 未来自主研究中心, 作者简介 未来自主研究中心,相关视频:地表最强AI主播Neuro-sama和她的老父亲Vedal一起正式入驻B站啦!,用C#部署yolov8的tensorrt模型进行目标检测winform最快检测速度,使用python部署yolov10的onnx模型,视频已失效,使用C#的winform部署yolov8的onnx实例分割模型,tesseract-ocr快速训练助手,C#winform部署yolov9的onnx模型,基于faster whisper实现实时语音识别项目语音转文本python编程实现,中学生自制下载器速度竟暴打IDM? | Ghost-Downloader 演示视频,OpenCvSharp利用微信二维码引擎实现二维码识别icon-default.png?t=N7T8https://www.bilibili.com/video/BV1RZpCeaE21/?vd_source=989ae2b903ea1b5acebbe2c4c4a635ee

【源码下载地址】

https://download.csdn.net/download/FL1623863129/89651183

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FL1623863129

你的打赏是我写文章最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值