-
Notifications
You must be signed in to change notification settings - Fork 3
/
branden_test.py
34 lines (19 loc) · 1.09 KB
/
branden_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from synthetic import DrawDocument, read_dictonary, RealBackGound, SolidBackGroundback
from article import generate
import os
import numpy as np
def create_bf(dir='/home/scstech/PycharmProjects/synthetic_handwritten/CNN_MODELS/test_set/F2-1'):
files = [os.path.join(dir,f) for f in os.listdir(dir) if f.split('.')[-1] == 'jpg']
np.random.shuffle(files)
print len(files)
realSampler = RealBackGound.create_bg(files=files[:15])
return realSampler
def run_realbackground(dir, path_background,num=9, size=None, greyscale=False,type='TXT',model='branden.xml'):
RealBackGound.dirname = path_background
realSampler = RealBackGound.load_examples()
generate(dir, num=num, size=size,sampler=realSampler, greyscale=greyscale,type=type,model=model)
#solidSampler = SolidBackGroundback(colors=[255])
#realSampler = RealBackGound.load_examples()
def run(dir, num=5, size=None, sampler=None, greyscale=False,type='TXT',model='branden2.xml',seed=2):
generate(dir, num=num, size=size,sampler=sampler, greyscale=greyscale,type=type,model=model,seed=seed)
#run('BRANDEN/TEST1602')