feat: add background generator
Browse files- font_dataset/background.py +14 -0
font_dataset/background.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from PIL import Image
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
__all__ = ["background_image_generator"]
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def background_image_generator(path="./dataset/pixivimages"):
|
| 9 |
+
image_list = os.listdir(path)
|
| 10 |
+
image_list = [os.path.join(path, image) for image in image_list]
|
| 11 |
+
|
| 12 |
+
while True:
|
| 13 |
+
for image in image_list:
|
| 14 |
+
yield image
|