Update probability to p (#3980)

This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-07-12 15:54:43 +02:00
1 parent 41fdf9fa53
commit b3dabdcc38
3 files changed
+34 -36

No files matched your search

+3 -4
View File
@@ -22,7 +22,7 @@ from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils.augmentations import Albumentations, augment_hsv, copy_paste, letterbox, mixup, random_perspective
from utils.augmentations import Albumentations, augment_hsv, copy_paste, letterbox, mixup, random_perspective, cutout
from utils.general import check_requirements, check_file, check_dataset, xywh2xyxy, xywhn2xyxy, xyxy2xywhn, \
xyn2xy, segments2boxes, clean_str
from utils.torch_utils import torch_distributed_zero_first
@@ -572,8 +572,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
labels[:, 1] = 1 - labels[:, 1]
# Cutouts
# if random.random() < 0.9:
# labels = cutout(img, labels)
# labels = cutout(img, labels, p=0.5)
labels_out = torch.zeros((nl, 6))
if nl:
@@ -682,7 +681,7 @@ def load_mosaic(self, index):
# img4, labels4 = replicate(img4, labels4) # replicate
# Augment
img4, labels4, segments4 = copy_paste(img4, labels4, segments4, probability=self.hyp['copy_paste'])
img4, labels4, segments4 = copy_paste(img4, labels4, segments4, p=self.hyp['copy_paste'])
img4, labels4 = random_perspective(img4, labels4, segments4,
degrees=self.hyp['degrees'],
translate=self.hyp['translate'],