Gabor Cselle commited on
Commit
db35ca2
1 Parent(s): 7987245

Added more fonts, bold and italics

Browse files
arrange_train_test_images.py CHANGED
@@ -22,7 +22,7 @@ for font in fonts:
22
  os.makedirs(font_train_dir, exist_ok=True)
23
  os.makedirs(font_test_dir, exist_ok=True)
24
 
25
- font_files = [f for f in os.listdir(GEN_IMAGES_DIR) if f.startswith(font)]
26
  random.shuffle(font_files)
27
 
28
  train_files = font_files[:int(0.8 * len(font_files))]
 
22
  os.makedirs(font_train_dir, exist_ok=True)
23
  os.makedirs(font_test_dir, exist_ok=True)
24
 
25
+ font_files = [f for f in os.listdir(GEN_IMAGES_DIR) if f.startswith(font + "_")]
26
  random.shuffle(font_files)
27
 
28
  train_files = font_files[:int(0.8 * len(font_files))]
consts.py CHANGED
@@ -1,7 +1,29 @@
1
  # number of images to generate per font
2
  IMAGES_PER_FONT = 50
3
  # allowlist of fonts to use
4
- FONT_ALLOWLIST = ["Arial", "Avenir", "Courier", "Helvetica", "Georgia", "Tahoma", "Times New Roman", "Verdana"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # directory where to store the generated images
6
  GEN_IMAGES_DIR = './generated_images'
7
  # images organized into train and test directories
 
1
  # number of images to generate per font
2
  IMAGES_PER_FONT = 50
3
  # allowlist of fonts to use
4
+ FONT_ALLOWLIST = ["Arial",
5
+ "Arial Black",
6
+ "Arial Bold Italic",
7
+ "Arial Bold",
8
+ "Avenir",
9
+ "Courier",
10
+ "Helvetica",
11
+ "Georgia",
12
+ "Tahoma",
13
+ "Tahoma Bold",
14
+ "Times New Roman",
15
+ "Times New Roman Bold",
16
+ "Times New Roman Italic",
17
+ "Times New Roman Bold Italic",
18
+ "Trebuchet MS",
19
+ "Trebuchet MS Bold",
20
+ "Trebuchet MS Italic",
21
+ "Trebuchet MS Bold Italic",
22
+ "Verdana",
23
+ "Verdana Bold",
24
+ "Verdana Italic",
25
+ "Verdana Bold Italic"
26
+ ]
27
  # directory where to store the generated images
28
  GEN_IMAGES_DIR = './generated_images'
29
  # images organized into train and test directories
train_font_identifier.py CHANGED
@@ -77,7 +77,6 @@ def validate(model, data_loader, criterion):
77
 
78
  print(image_datasets['train'].classes)
79
 
80
-
81
  # Training loop with progress bar for epochs
82
  num_epochs = 10 # Replace with the number of epochs you'd like to train for
83
  for epoch in range(num_epochs):
 
77
 
78
  print(image_datasets['train'].classes)
79
 
 
80
  # Training loop with progress bar for epochs
81
  num_epochs = 10 # Replace with the number of epochs you'd like to train for
82
  for epoch in range(num_epochs):
visualize.ipynb CHANGED
The diff for this file is too large to render. See raw diff