Giter Site home page Giter Site logo

langchain-chatglm3's Introduction

Intelligent-Image-Matting-System

1、系统功能:

本项目使用显著性目标检测技术实现了一个智能抠图系统。其中显著性目标检测技术是自己设计的基于金字塔视觉Transformer( Pyramid Vision Transforme)的非对称RGBD显著性目标检测网络(PVTANet)。后面会简单介绍一下这个网络。

2、系统流程:

实现抠图功能的代码放在demo.py文件中。

这段代码使用Python和OpenCV库实现图片合成代码。代码中的功能是将两张图片进行合成,其中一张图片是原始的RGB图像,另一张图片是表示透明度的alpha图像。

我们挑选了几张代表不同场景下的图片。原始的RGB图像放在 /original_images 文件夹中,alpha图像是使用我们提出的显著性检测网络(PVTANet)检测得到的显著性预测图像,放在 /alpha_images 文件夹中。

在Alpha图像中,每个像素都有一个额外的通道,通常用于表示该像素的透明度级别。这个额外的通道通常被称为Alpha通道。Alpha通道的取值范围通常是0到255之间,其中0表示完全透明,255表示完全不透明。对于介于0和255之间的值,表示了介于完全透明和完全不透明之间的透明度级别。

实现抠图的主要流程为

  1. 首先使用cv2.imread()函数读取原始RGB图像,以灰度图的方式读取alpha图像
  2. 获取原始RGB图像的尺寸(高度、宽度、通道数),并创建一个全零数组img3来存储合成后的图片,大小与原始RGB图像相同,但通道数为4。
  3. 将原始RGB图像的像素值复制到img3的前三个通道中(RGB通道)
  4. 将alpha图像的像素值复制到img3的第四个通道中,这样img3就成为了一个带有透明度信息的RGBA图像。
  5. 使用cv2.imwrite()函数将合成后的图片保存到指定路径中。

我们的网络经过抠图得到的结果如下,详细结果在/cutout_images 文件夹中

1

这幅图中,可以看出我们的网络可以很清晰地将显著性目标从它所处的复杂环境中抠取出来。

3、PVTANet简单介绍

PVTANet是我们提出的一种基于金字塔视觉Transformer(PVT)的非对称显著性目标检测网络。具体来说,我们认识到当前主流对称网络结构在处理 RGB 和深度特征时忽略数据固有差异、导致难以充分融合进而导致了信息丢失和性能下降等问题。

为了更好提取不同模态数据中的有效特征,我们使用不同的编码器进行特征提取,通过利用 PVT 从 RGB 图像中提取特征,并设计了一个轻量级深度模块用于深度特征提取。该模块通过特征交互和空间自注意力机制加强对深度特征的理解和利用。

为了更好地融合 RGB 和深度特征,我们提出了流梯度融合模块,以渐进的方式融合不同级别的特征并保留细节信息。同时引入深度注意力模块确保深度特征有效引导 RGB 特征,从而充分利用深度特征中的几何特征。 PVTANet的网络结构图如下图所示:

图4-1.png

在网络训练过程中,我们使用PVT v2-b2作为骨干网络,以及使用它的预训练参数初始化,动量、权重衰减、批量大小和学习率分别设定为 0.9、0.0005、6 和 1e-10 本文的网络在 PyTorch 深度学习框架上实现,并在一块 NVIDIA GeForce RTX 3080 GPU 上加速。 最终在六个数据集上测试的定量P-R曲线如下: P-R.png 定性评估如下:

图4-6.png

langchain-chatglm3's People

Contributors

struggle1999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

langchain-chatglm3's Issues

代码部署问题

代码里service.config、service.chatglm_service分别是指的什么?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.