旷视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.hqwc.cn/news/433732.html

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

相关文章

vue3项目中使用Arco Design-Table组件结合h()函数生成表格嵌套表格效果

vue3项目中使用Arco Design-Table组件【点击跳转】结合vue3-h()函数【点击跳转】生成表格嵌套表格效果。 示例效果如下&#xff1a; 【方式一】 给Table组件设置表格的“展开行配置”参数&#xff1a;expandable <a-table :expandable"expandable"></a-t…

归并排序和计数排序讲解

. 个人主页&#xff1a;晓风飞 专栏&#xff1a;数据结构|Linux|C语言 路漫漫其修远兮&#xff0c;吾将上下而求索 文章目录 前言归并排序&#xff08;递归&#xff09;动图&#xff1a;代码实现以下是代码详细讲解&#xff1a; 归并排序非递归代码实现以下是代码详细讲解&…

[java基础揉碎]do..while循环控制

基本语法: 说明: 1.先执行, 在判断, 也就是一定会执行一次 2.结尾有分号

把批量M3U8网络视频地址转为MP4视频

在数字媒体时代&#xff0c;视频格式的转换已成为一项常见的需求。尤其对于那些经常处理网络视频的用户来说&#xff0c;将M3U8格式的视频转换为更常见的MP4格式是一项必备技能。幸运的是&#xff0c;现在有了固乔剪辑助手这款强大的工具&#xff0c;这一过程变得异常简单。下面…

如何将前后端分离(vue2+SpringBoot)项目部署到腾讯云服务器

如何将前后端分离&#xff08;vue2SpringBoot&#xff09;项目部署到腾讯云服务器 目录 如何将前后端分离&#xff08;vue2SpringBoot&#xff09;项目部署到腾讯云服务器 1、在选中目录地下新建2个文件夹 2、将打包好的前端项目和后端jar包上传到相应的目录下 3、将路径切…

[C++]使用纯opencv部署yolov8旋转框目标检测

【官方框架地址】 https://github.com/ultralytics/ultralytics 【算法介绍】 YOLOv8是一种先进的对象检测算法&#xff0c;它通过单个神经网络实现了快速的物体检测。其中&#xff0c;旋转框检测是YOLOv8的一项重要特性&#xff0c;它可以有效地检测出不同方向和角度的物体。…

idea结合git回到某个提交点

概述&#xff1a;在IntelliJ IDEA中&#xff0c;你可以使用Git工具来回到某个提交点。 第一步&#xff1a;打开idea&#xff0c;打开git的管理面 可以看到&#xff0c;由于我的大改动&#xff0c;导致现在出问题了&#xff0c;所以我准备回退到某一版本。 点击左下角的git 点…

(大众金融)SQL server面试题(3)-客户已用额度总和

今天&#xff0c;面试了一家公司&#xff0c;什么也不说先来三道面试题做做&#xff0c;第三题。 那么&#xff0c;我们就开始做题吧&#xff0c;谁叫我们是打工人呢。 题目是这样的&#xff1a; DEALER_INFO经销商授信协议号码经销商名称经销商证件号注册地址员工人数信息维…

蓝桥杯备赛 week 4 —— DP 背包问题

目录 &#x1f308;前言&#x1f308;&#xff1a; &#x1f4c1; 01背包问题 分析&#xff1a; dp数组求解&#xff1a; 优化&#xff1a;滚动数组&#xff1a; &#x1f4c1; 完全背包问题 &#x1f4c1; 总结 &#x1f308;前言&#x1f308;&#xff1a; 这篇文章主…

水文模型SWMM与LisFlood耦合(pdf文档、软件见资源)

总技术路线图 INP生成图解 文献&#xff1a;面向服务的Web-SWMM构建研究 regardingINP为ArcGIS Pro项目 1.SWMM模型数据准备与参数设置 1.子汇水区 文件位于&#xff1a;beforeGenerateINP/generateSub.py&#xff08;一级划分&#xff09; 问题&#xff1a; 水文分析阈值划…

文献翻译 || Ubuntu安装zotero文献管理软件,提高文献阅读效率

文章目录 前言安装方式选择apt方式snap方式 zotero的简单使用文献导入中文翻译插件下载并安装使用体验 前言 虽然在win下有很多文献管理软件和好用的文献翻译软件&#xff0c;但是如果平常有使用Ubuntu进行开发的需求&#xff0c;实际上很不愿意为了好好看文献专门切到Windows…

万界星空科技可视化数据大屏的作用

随着科技的不断发展和进步&#xff0c;当前各种数据化的设备也是如同雨后春笋般冒了出来&#xff0c;并且其可以说是给我们带来了极大的便利的。在这其中&#xff0c;数据大屏就是非常具有代表性的一个例子。 数据大屏的主要作用包括&#xff1a; 数据分析&#xff1a;数据大屏…