|
Algorithm 1 Constructing an oversampled balanced dataset |
-
Input:
: Directory containing class folders with images
-
Output:
Oversampled balanced dataset
-
1:
Identify and enumerate all classes in
-
2:
Count the number of images per class
-
3:
maximum image count across classes
-
4:
-
5:
for each class c do
-
6:
count of images in class c
-
7:
if then
-
8:
Oversample class c up to using
-
9:
end if
-
10:
for to do
-
11:
-
12:
path of -th image in class c
-
13:
Load image from
-
14:
Apply to the image
-
15:
if then
-
16:
Apply to augment the image
-
17:
end if
-
18:
Apply to the image
-
19:
Return image and class label
-
20:
end for
-
21:
end for
|