yjh0410 1 tahun lalu
induk
melakukan
8bca531e89

+ 0 - 1
yolo/config/gelan_config.py

@@ -118,7 +118,6 @@ class GElanBaseConfig(object):
         ## Transforms
         self.train_img_size = 640
         self.test_img_size  = 640
-        self.use_ablu = True
         self.affine_params = {
             'degrees': 0.0,
             'translate': 0.2,

+ 0 - 1
yolo/config/yolov3_config.py

@@ -106,7 +106,6 @@ class Yolov3BaseConfig(object):
         ## Transforms
         self.train_img_size = 640
         self.test_img_size  = 640
-        self.use_ablu = True
         self.affine_params = {
             'degrees': 0.0,
             'translate': 0.2,

+ 0 - 1
yolo/config/yolov5_af_config.py

@@ -104,7 +104,6 @@ class Yolov5AFBaseConfig(object):
         ## Transforms
         self.train_img_size = 640
         self.test_img_size  = 640
-        self.use_ablu = True
         self.affine_params = {
             'degrees': 0.0,
             'translate': 0.2,

+ 0 - 1
yolo/config/yolov5_config.py

@@ -106,7 +106,6 @@ class Yolov5BaseConfig(object):
         ## Transforms
         self.train_img_size = 640
         self.test_img_size  = 640
-        self.use_ablu = True
         self.affine_params = {
             'degrees': 0.0,
             'translate': 0.2,

+ 0 - 1
yolo/config/yolov6_config.py

@@ -99,7 +99,6 @@ class Yolov6BaseConfig(object):
         ## Transforms
         self.train_img_size = 640
         self.test_img_size  = 640
-        self.use_ablu = True
         self.affine_params = {
             'degrees': 0.0,
             'translate': 0.2,

+ 0 - 1
yolo/config/yolov8_config.py

@@ -106,7 +106,6 @@ class Yolov8BaseConfig(object):
         ## Transforms
         self.train_img_size = 640
         self.test_img_size  = 640
-        self.use_ablu = True
         self.affine_params = {
             'degrees': 0.0,
             'translate': 0.2,

+ 0 - 1
yolo/config/yolov8_e2e_config.py

@@ -104,7 +104,6 @@ class Yolov8E2EBaseConfig(object):
         ## Transforms
         self.train_img_size = 640
         self.test_img_size  = 640
-        self.use_ablu = True
         self.affine_params = {
             'degrees': 0.0,
             'translate': 0.2,

+ 0 - 1
yolo/dataset/build.py

@@ -65,7 +65,6 @@ def build_transform(cfg, is_train=False):
         if is_train:
             transform = YOLOAugmentation(cfg.train_img_size,
                                          cfg.affine_params,
-                                         cfg.use_ablu,
                                          cfg.pixel_mean,
                                          cfg.pixel_std,
                                          cfg.box_format,

+ 0 - 40
yolo/dataset/data_augment/yolo_augment.py

@@ -2,7 +2,6 @@ import random
 import cv2
 import math
 import numpy as np
-import albumentations as albu
 
 import torch
 import torchvision.transforms.functional as F
@@ -99,31 +98,6 @@ def augment_hsv(img, hgain=0.5, sgain=0.5, vgain=0.5):
 
     return img
 
-## Ablu transform
-class Albumentations(object):
-    def __init__(self, img_size=640):
-        self.img_size = img_size
-        self.transform = albu.Compose(
-            [albu.Blur(p=0.01),
-             albu.MedianBlur(p=0.01),
-             albu.ToGray(p=0.01),
-             albu.CLAHE(p=0.01),
-             ],
-             bbox_params=albu.BboxParams(format='pascal_voc', label_fields=['labels'])
-        )
-
-    def __call__(self, image, target=None):
-        labels = target['labels']
-        bboxes = target['boxes']
-        if len(labels) > 0:
-            new = self.transform(image=image, bboxes=bboxes, labels=labels)
-            if len(new["labels"]) > 0:
-                image = new['image']
-                target['labels'] = np.array(new["labels"], dtype=labels.dtype)
-                target['boxes'] = np.array(new["bboxes"], dtype=bboxes.dtype)
-
-        return image, target
-
 
 # ------------------------- Preprocessers -------------------------
 ## YOLO-style Transform for Train
@@ -131,7 +105,6 @@ class YOLOAugmentation(object):
     def __init__(self,
                  img_size=640,
                  affine_params=None,
-                 use_ablu=False,
                  pixel_mean = [0., 0., 0.],
                  pixel_std  = [255., 255., 255.],
                  box_format='xyxy',
@@ -144,8 +117,6 @@ class YOLOAugmentation(object):
         self.affine_params = affine_params
         self.normalize_coords = normalize_coords
         self.color_format = 'bgr'
-        # Albumentations
-        self.ablu_trans = Albumentations(img_size) if use_ablu else None
 
     def __call__(self, image, target, mosaic=False):
         # --------------- Resize image ---------------
@@ -160,17 +131,6 @@ class YOLOAugmentation(object):
         target["boxes"][..., [0, 2]] = target["boxes"][..., [0, 2]] / orig_w * img_w
         target["boxes"][..., [1, 3]] = target["boxes"][..., [1, 3]] / orig_h * img_h
 
-        # --------------- Filter bad targets ---------------
-        tgt_boxes_wh = target["boxes"][..., 2:] - target["boxes"][..., :2]
-        min_tgt_size = np.min(tgt_boxes_wh, axis=-1)
-        keep = (min_tgt_size > 1)
-        target["boxes"]  = target["boxes"][keep]
-        target["labels"] = target["labels"][keep]
-
-        # --------------- Albumentations ---------------
-        if self.ablu_trans is not None:
-            image, target = self.ablu_trans(image, target)
-
         # --------------- HSV augmentations ---------------
         image = augment_hsv(image,
                             hgain=self.affine_params['hsv_h'],