retinaface自定义增强

本文探讨了针对RetinaFace算法的自定义图像增强策略,主要集中在通过宽高比不同的裁剪方法来提升模型的训练效果和泛化能力。
摘要由CSDN通过智能技术生成

宽高分别裁剪增强

import cv2
import numpy as np
import random
from utils.box_utils import matrix_iof


def _crop(image, boxes, labels, img_size):
    #随意裁剪,裁剪到最后resize,会有放大效果,不会缩小,小目标检测无帮助
    height, width, _ = image.shape
    pad_image_flag = True
    if boxes[0][1] == 0:
        scale = random.uniform(0.3, 1.0)
        crop_height = int(scale * height)
        crop_width = int(scale * width)

        crop_left = 0
        if width != crop_width:
            crop_left = random.randrange(width - crop_width)
        crop_top = 0
        if height != crop_height:
            crop_top = random.randrange(height - crop_height)
        roi = np.array((crop_left, crop
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

AI算法网奇

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值