Technology sharing

Problema de low recall rate of training long bar scuta in yolov5

2024-07-11

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Nam scuta longa cum ratione respectiva magnae rationis, sicut 1000pix in longitudine, 10pix in latitudine, etc., quaestio de absentis pittaciis in aliquibus imaginibus in notitiis ma- nicis imaginibus aucta in exercitatione erit in imaginibus aucta.

In codice disciplinae, box_candidates functiones in augmentations.py fasciculus in random_perspective ad eliquationem pittacorum imaginum post transmutationem perspectiva, remove cistas nimis parvas (area minor est quam area ante tondendum) et retinent longitudinem ac latitudo cippi

  1. def box_candidates(box1, box2, wh_thr=2, ar_thr=20, area_thr=0.1, eps=1e-16):
  2. """box_candidates() is used to filter the labels and reject poor label candidates:
  3. 用在random_perspective中 对透视变换后的图片label进行筛选
  4. 去除被裁剪过小的框(面积小于裁剪前的area_thr) 还有长和宽必须大于wh_thr个像素,且长宽比范围在(1/ar_thr, ar_thr)之间的限制
  5. Compute candidate boxes: box1 before augment, box2 after augment, wh_thr (pixels), aspect_ratio_thr, area_ratio
  6. :params box1: [4, n]
  7. :params box2: [4, n]
  8. :params wh_thr: 筛选条件 宽高阈值
  9. :params ar_thr: 筛选条件 宽高比、高宽比最大值阈值
  10. :params area_thr: 筛选条件 面积阈值
  11. :params eps: 1e-16 接近0的数 防止分母为0
  12. :return i: 筛选结果 [n] 全是True或False 使用比如: box1[i]即可得到i中所有等于True的矩形框 False的矩形框全部删除
  13. """
  14. w1, h1 = box1[2] - box1[0], box1[3] - box1[1] # 求出所有box1矩形框的宽和高 [n] [n]
  15. w2, h2 = box2[2] - box2[0], box2[3] - box2[1] # 求出所有box2矩形框的宽和高 [n] [n]
  16. ar = np.maximum(w2 / (h2 eps), h2 / (w2 eps)) # 求出所有box2矩形框的宽高比和高宽比的较大者 [n, 1]
  17. # 筛选条件: 增强后w、h要大于2 增强后图像与增强前图像面积比值大于area_thr 宽高比大于ar_thr
  18. return (