image weights compatible faster random index generator v2 for mosaic augmentation (#2383)
image weights compatible faster random index generator v2 for mosaic augmentation
This commit is contained in:
1 parent
c64fe219b4
commit
cd8ed3521d
1 file changed
+2
-2
+2
-2
@@ -666,7 +666,7 @@ def load_mosaic(self, index):
|
||||
labels4, segments4 = [], []
|
||||
s = self.img_size
|
||||
yc, xc = [int(random.uniform(-x, 2 * s + x)) for x in self.mosaic_border] # mosaic center x, y
|
||||
indices = [index] + [self.indices[random.randint(0, self.n - 1)] for _ in range(3)] # 3 additional image indices
|
||||
indices = [index] + random.choices(self.indices, k=3) # 3 additional image indices
|
||||
for i, index in enumerate(indices):
|
||||
# Load image
|
||||
img, _, (h, w) = load_image(self, index)
|
||||
@@ -721,7 +721,7 @@ def load_mosaic9(self, index):
|
||||
|
||||
labels9, segments9 = [], []
|
||||
s = self.img_size
|
||||
indices = [index] + [self.indices[random.randint(0, self.n - 1)] for _ in range(8)] # 8 additional image indices
|
||||
indices = [index] + random.choices(self.indices, k=8) # 8 additional image indices
|
||||
for i, index in enumerate(indices):
|
||||
# Load image
|
||||
img, _, (h, w) = load_image(self, index)
|
||||
|
||||
Reference in new issue
Block a user