Table of Contents
效果:
参考CSP网络的Github源码,人体检测常用的两个数据增强方法:水平随机翻转,随机亮度
水平翻转code很多,下面只讲一下随机明暗亮度,实际中亮度范围根据实际需要选择,比如0.7-1.3
由原始变为最亮:(范围0.5-1.9),正常亮度为1

由原始变为最暗:
代码实现
随机亮度:(这对于网络的明暗适应性很重要)
import cv2
from matplotlib import pyplot as plt
import numpy as np
def _brightness(image, min=0.5, max=2.0):
'''
Randomly change the brightness of the input image.
Protected against