旷视low-level系列(一):Bayer Pattern Unification and Bayer Preserving Au

文章目录

  • 1. Motivation
  • 2. Contribution
  • 3. Methods
    • 3.1 BayerUnify
    • 3.2 BayerAug
  • 4. Comments
  • Reference

1. Motivation

对于RAW域去噪,通常会将单通道bayer格式的RAW图打包成4通道,然后送入神经网络。不同厂家生产的sensor出的RAW图可能具有不同的bayer模式,通常是RGGB,BGGR, GRBG和GBRG。
业内做AI-ISP的攻城狮们应该都会遇到这样一个问题,在适配不同sensor的过程中会积累大量具有不同Bayer模式的数据,然后在训练模型时都想用上,这时大家都会将这些异源的数据统一成相同的bayer模式,常用的操作有:① 在裁剪patch时根据目标bayer模式选择合适的起点;② 打包成4通道,然后交换通道顺序。论文作者发现第二种方式会产生伪影,而第一种方式不会。
另外,数据增强是训练神经网络时提升性能的一种常用手段,对于RAW数据,为了避免破坏bayer模式,通常会选择在打包成4通道后再做翻转和旋转等增强。然而作者发现这样也会产生伪影,并提出了相应的解决方案。
在这里插入图片描述

2. Contribution

  • 提出了BayerUnify,将不同的bayer模式转换为一个统一的模式,充分利用异源数据,扩大训练集规模
  • 提出了BayerAug,一种有效的RAW图像的数据增强方式

3. Methods

3.1 BayerUnify

训练阶段采用crop的方式将当前bayer模式转换为目标bayer模式
在这里插入图片描述
推理阶段采用先pad的方式转换bayer模式(crop会丢失信息),对神经网络的输出再做crop得到与原始图像格式一致的结果。
在这里插入图片描述

def bayer_unify(raw: np.ndarray, input_pattern: str, target_pattern: str, mode: str) -> Tuple:"""Convert a bayer raw image from one bayer pattern to another.Parameters----------raw : np.ndarray in shape (H, W)Bayer raw image to be unified.input_pattern : {"RGGB", "BGGR", "GRBG", "GBRG"}The bayer pattern of the input image.target_pattern : {"RGGB", "BGGR", "GRBG", "GBRG"}The expected output pattern.mode: {"crop", "pad"}The way to handle submosaic shift. "crop" abandons the outmost pixels,and "pad" introduces extra pixels. Use "crop" in training and "pad" intesting."""if input_pattern not in BAYER_PATTERNS:raise ValueError('Unknown input bayer pattern!')if target_pattern not in BAYER_PATTERNS:raise ValueError('Unknown target bayer pattern!')if mode not in NORMALIZATION_MODE:raise ValueError('Unknown normalization mode!')if not isinstance(raw, np.ndarray) or len(raw.shape) != 2:raise ValueError('raw should be a 2-dimensional numpy.ndarray!')if input_pattern == target_pattern:h_offset, w_offset = 0, 0elif input_pattern[0] == target_pattern[2] and input_pattern[1] == target_pattern[3]:h_offset, w_offset = 1, 0elif input_pattern[0] == target_pattern[1] and input_pattern[2] == target_pattern[3]:h_offset, w_offset = 0, 1elif input_pattern[0] == target_pattern[3] and input_pattern[1] == target_pattern[2]:h_offset, w_offset = 1, 1else:  # This is not happening in ["RGGB", "BGGR", "GRBG", "GBRG"]raise RuntimeError('Unexpected pair of input and target bayer pattern!')if mode == "pad":out = np.pad(raw, [[h_offset, h_offset], [w_offset, w_offset]], 'reflect')elif mode == "crop":h, w = raw.shapeout = raw[h_offset:h - h_offset, w_offset:w - w_offset]else:raise ValueError('Unknown normalization mode!')return out, h_offset, w_offset

3.2 BayerAug

直接对RAW数据做翻转会改变bayer模式,BayerAug先翻转再执行BayerUnify,保证bayer模式不变。
在这里插入图片描述

def bayer_aug(raw: np.ndarray, flip_h: bool, flip_w: bool, transpose: bool, input_pattern: str) -> np.ndarray:"""Apply augmentation to a bayer raw image.Parameters----------raw : np.ndarray in shape (H, W)Bayer raw image to be augmented. H and W must be even numbers.flip_h : boolIf True, do vertical flip.flip_w : boolIf True, do horizontal flip.transpose : boolIf True, do transpose.input_pattern : {"RGGB", "BGGR", "GRBG", "GBRG"}The bayer pattern of the input image."""if input_pattern not in BAYER_PATTERNS:raise ValueError('Unknown input bayer pattern!')if not isinstance(raw, np.ndarray) or len(raw.shape) != 2:raise ValueError('raw should be a 2-dimensional numpy.ndarray')if raw.shape[0] % 2 == 1 or raw.shape[1] % 2 == 1:raise ValueError('raw should have even number of height and width!')aug_pattern, target_pattern = input_pattern, input_patternout = rawif flip_h:out = out[::-1, :]aug_pattern = aug_pattern[2] + aug_pattern[3] + aug_pattern[0] + aug_pattern[1]if flip_w:out = out[:, ::-1]aug_pattern = aug_pattern[1] + aug_pattern[0] + aug_pattern[3] + aug_pattern[2]if transpose:out = out.Taug_pattern = aug_pattern[0] + aug_pattern[2] + aug_pattern[1] + aug_pattern[3]out = bayer_unify(out, aug_pattern, target_pattern, "crop")return out

4. Comments

初看,就这?用起来,还挺香。没有很大的创新,胜在工程价值较高。

Reference

[1] Learning Raw Image Denoising with Bayer Pattern Unification and Bayer Preserving Augmentation
[2] 官方代码

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/650140.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SpringBoot中阿里云OSS的使用

目录 1 登录/注册阿里云并进入控制台 2 进入OSS控制台 3 创建bucket 4 查看bucket 5 获取AccessKey 6 查看帮助文档 7 添加Maven依赖 8 获取示例代码并改造成工具类 9 测试 1 登录/注册阿里云并进入控制台 2 进入OSS控制台 3 创建bucket 4 查看bucket 5 获取AccessKe…

最优化基础 - (最优化问题分类、凸集)

系统学习最优化理论 什么是最优化问题? 决策问题: (1)决策变量 (2)目标函数(一个或多个) (3)一个可由可行策略组成的集合(等式约束或者不等式约束…

Ubuntu使用Docker部署Redis并实现远程访问本地数据库

文章目录 前言1. 安装Docker步骤2. 使用docker拉取redis镜像3. 启动redis容器4. 本地连接测试4.1 安装redis图形化界面工具4.2 使用RDM连接测试 5. 公网远程访问本地redis5.1 内网穿透工具安装5.2 创建远程连接公网地址5.3 使用固定TCP地址远程访问 前言 本文主要介绍如何在Ub…

Windows10系统任务栏变小怎么处理

首先,邮件任务栏,点击任务栏设置; 然后,将小任务栏 使能关闭(图中为打开状态); 或者,你也可以取消锁定任务栏,然后在任务栏的边缘,进行上下拉拖动&#xff…

Python 有用的库模块

简介 Python中有许多常用的库或者模块,在写代码的时候或多或少会遇到,本文对其进行总结,方便日后查阅。 pprint Python中的pprint模块是用于打印数据结构(如字典,列表等)的模块,提供了一种以…

ARCGIS PRO SDK 常用的选择操作

一、获取当前图层FeatureLayer选择要素: ly选择要素 Dim selSet As Selection ly.GetSelection() 二、获取当前激活的地图选择要素集: 不同层的所有的选择要素 Dim selSet As SelectionSet ArcGIS.Desktop.Mapping.MapView.Active.Map.GetSelection() 三、用例 Map&…

力扣0081——搜索旋转排序数组II

搜索旋转排序数组II 难度&#xff1a;中等 题目描述 已知存在一个按非降序排列的整数数组 nums &#xff0c;数组中的值不必互不相同。 在传递给函数之前&#xff0c;nums 在预先未知的某个下标 k&#xff08;0 < k < nums.length&#xff09;上进行了 **旋转 **&…

Java技术栈 —— zookeeper入门(一)

一、什么是zookeeper&#xff1f; 一、 参考文章或视频链接[1] What is Apache ZooKeeper?[2] Welcome to Apache ZooKeeper 二、安装、启动与停止zookeeper 安装方式见菜鸟教程[1]。 $ cd bin/ # 启动zookeeper $ sh zkServer.sh start # 停止zookeeper $ sh zkServer.sh…

【197】JAVA8调用阿里云对象存储API,保存图片并获取图片URL地址。

实际工作中&#xff0c;需要用阿里云对象存储保存图片&#xff0c;并且在上传图片到阿里云对象存储服务器后&#xff0c;获取图片在阿里云对象存储服务器的URL地址&#xff0c;以便给 WEB 前端显示。 阿里云对象存储上传图片的工具类 package zhangchao;import com.aliyun.os…

漏洞复现-EduSoho任意文件读取漏洞(附漏洞检测脚本)

免责声明 文章中涉及的漏洞均已修复&#xff0c;敏感信息均已做打码处理&#xff0c;文章仅做经验分享用途&#xff0c;切勿当真&#xff0c;未授权的攻击属于非法行为&#xff01;文章中敏感信息均已做多层打马处理。传播、利用本文章所提供的信息而造成的任何直接或者间接的…

IDC机房交换机核心技术与应用指南

IDC机房交换机核心技术与应用指南 ​ 在这个快速发展的数字时代&#xff0c;数据中心作为信息技术的心脏&#xff0c;不仅承载着海量数据的处理、存储和传输&#xff0c;更是支撑着全球企业运营和互联网服务的关键基础设施。在众多构成数据中心的组件中&#xff0c;IDC机房交换…

【运行Python爬虫脚本示例】

主要内容&#xff1a;Python中的两个库的使用。 1、requests库&#xff1a;访问和获取网页内容&#xff0c; 2、beautifulsoup4库&#xff1a;解析网页内容。 一 python 爬取数据 1 使用requests库发送GET请求&#xff0c;并使用text属性获取网页内容。 然后可以对获取的网页…

排序算法——希尔排序算法详解

希尔排序算法详解 一. 引言1. 背景介绍1.1 数据排序的重要性1.2 希尔排序的由来 2. 排序算法的分类2.1 比较排序和非比较排序2.2 希尔排序的类型 二. 希尔排序基本概念1. 希尔排序的定义1.1 缩小增量排序1.2 插入排序的变种 2. 希尔排序的工作原理2.1 分组2.2 插入排序2.3 逐步…

2024 高级前端面试题之 JS 「精选篇」

该内容主要整理关于 JS 的相关面试题&#xff0c;其他内容面试题请移步至 「最新最全的前端面试题集锦」 查看。 JS模块精选篇 1. 数据类型基础1.1 JS内置类型1.2 null和undefined区别1.3 null是对象吗&#xff1f;为什么&#xff1f;1.4 1.toString()为什么可以调用&#xff1…

LLM之Agent(九)| 通过API集成赋能Autogen Multi-Agent系统

随着大型语言模型的快速发展&#xff0c;构建基于LLM驱动的自治代理&#xff08;autonomous agents&#xff09;已经成为一个备受关注的话题。仅在过去一年中&#xff0c;就出现了许多基于这一理念的新技术和框架。 ​ 本文将探索微软开源的Agent框架&#xff1a;Autogen…

快速搭建一个基于MVC架构的Spring Boot应用

提示&#xff1a;如果对 MVC 架构模式不熟悉可以看我的博客 > MVC架构模式与三层架构 快速搭建一个基于MVC架构的Spring Boot应用 一、Web 服务二、快速构建一个Spring Web MVC的 Web 应用1.使用脚手架快速的搭建环境&#xff1a;2.准备数据库&#xff1a;3.编写Dao层访问数…

一行命令在 wsl-ubuntu 中使用 Docker 启动 Windows

在 wsl-ubuntu 中使用 Docker 启动 Windows 0. 背景1. 验证我的系统是否支持 KVM&#xff1f;2. 使用 Docker 启动 Windows3. 访问 Docker 启动的 Windows4. Docker Hub 地址5. Github 地址 0. 背景 我们可以在 Windows 系统使用安装 wsl-ubuntu&#xff0c;今天玩玩在 wsl-ub…

黑群晖屏蔽更新

黑群晖屏蔽更新 修改Host删除控制面板的红点和更新提示 修改Host ssh连接群晖后执行以下命令 sudo vim /etc/hosts按i键进入编辑模式 光标移动定位到最后一行后追加以下两行 127.0.0.1 update.synology.com 127.0.0.1 update7.synology.com按esc键&#xff0c;然后输入:wq并…

《PCI Express体系结构导读》随记 —— 第I篇 第3章 PCI总线的数据交换(4)

接前一篇文章&#xff1a;《PCI Express体系结构导读》随记 —— 第I篇 第3章 PCI总线的数据交换&#xff08;3&#xff09; 3.2 PCI设备的数据传递 PCI设备的数据传递使用地址译码方式&#xff0c;当一个存储器读写总线事务到达PCI总线时&#xff0c;在这条总线上的所有PCI设…

[C++]priority_queue——优先级队列(含模拟实现)

一、priority_queue是什么 priority_queue 是容器适配器&#xff0c;它提供常数时间的&#xff08;默认&#xff09;最大元素查找&#xff0c;对数代价的插入与释出。 可用用户 提供的 Compare 更改顺序&#xff0c;例如&#xff0c;用 std::greater<T> 将导致最小元素作…