ERROR in Generating Greek language images
Ham714 opened this issue · 6 comments
Traceback (most recent call last):
File "C:\Users\Muhammad Hamza\AppData\Roaming\Python\Python39\site-packages\synthtiger\gen.py", line 121, in _generate
data = template.generate()
File "E:\datasetPADDLE\examples\synthtiger\template.py", line 113, in generate
fg_image, label, bboxes, glyph_fg_image, glyph_bboxes = self._generate_text(
File "E:\datasetPADDLE\examples\synthtiger\template.py", line 217, in _generate_text
label = self.corpus.data(self.corpus.sample())
File "C:\Users\Muhammad Hamza\AppData\Roaming\Python\Python39\site-packages\synthtiger\components\wrapper\selector.py", line 29, in sample
idx = meta.get("idx", self._sample_idx())
File "C:\Users\Muhammad Hamza\AppData\Roaming\Python\Python39\site-packages\synthtiger\components\wrapper\selector.py", line 58, in _sample_idx
idx = np.random.choice(len(self.components), replace=False, p=self._probs)
File "mtrand.pyx", line 932, in numpy.random.mtrand.RandomState.choice
ValueError: 'a' and 'p' must have same size
kindly someone help
Hi,
It seems that the number of corpus weights is different from the number of corpus.
Please check config file.
https://github.com/clovaai/synthtiger/blob/master/examples/synthtiger/config_horizontal.yaml#L16
This example has two corpus (length augmentable corpus, char augmentable corpus) and two corpus weights (1, 0).
Hi,
It seems that the number of corpus weights is different from the number of corpus. Please check config file.
https://github.com/clovaai/synthtiger/blob/master/examples/synthtiger/config_horizontal.yaml#L16 This example has two corpus (length augmentable corpus, char augmentable corpus) and two corpus weights (1, 0).
Sorry, can you guide what to change, im trying to generate greek images from corpus, im using this config file, i change the weight but i dont know why still getting the same error
coord_output: true
mask_output: true
glyph_coord_output: true
glyph_mask_output: true
vertical: false
quality: [50, 95]
visibility_check: true
midground: 0.25
midground_offset:
percents: [[-0.5, 0.5], [-0.5, 0.5]]
foreground_mask_pad: 5
corpus:
weights: [1]
args:
# length augmentable corpus
- paths: [resources/corpus/ge.txt]
weights: [1]
min_length: 1
max_length: 25
textcase: [lower, upper, capitalize]
augmentation: 0.1
augmentation_length: [1, 25]
# char augmentable corpus
- paths: []
weights: []
min_length: 1
max_length: 25
textcase: [lower, upper, capitalize]
augmentation: 0
augmentation_charset: resources/charset/alphanum_special.txt
font:
paths: [resources/font]
weights: [1]
size: [40, 80]
bold: 0.5
texture:
prob: 0.5
args:
paths: [resources/image]
weights: [1]
alpha: [0, 1]
grayscale: 0
crop: 1
colormap2:
paths: [resources/colormap/iiit5k_gray.txt]
weights: [1]
k: 2
alpha: [1, 1]
colorize: 1
colormap3:
paths: [resources/colormap/iiit5k_gray.txt]
weights: [1]
k: 3
alpha: [1, 1]
colorize: 1
color:
gray: [0, 255]
alpha: [1, 1]
colorize: 1
shape:
prob: 1
args:
weights: [1, 1]
args:
# elastic distortion
- alpha: [15, 30]
sigma: [4, 12]
# elastic distortion
- alpha: [0, 2]
sigma: [0, 0.6]
layout:
weights: [4, 1]
args:
# flow layout
- space: [-2, 5]
line_align: [middle]
# curve layout
- curve: [20, 40]
space: [-2, 5]
convex: 0.5
upward: 0.5
style:
prob: 0.25
args:
weights: [1, 2, 2]
args:
# text border
- size: [1, 12]
alpha: [1, 1]
grayscale: 0
# text shadow
- distance: [1, 6]
angle: [0, 360]
alpha: [0.3, 0.7]
grayscale: 0
# text extrusion
- length: [1, 12]
angle: [0, 360]
alpha: [1, 1]
grayscale: 0
transform:
prob: 1
args:
weights: [1, 1, 1, 1, 1, 1, 2]
args:
# perspective x
- percents: [[0.5, 1], [1, 1]]
aligns: [[0, 0], [0, 0]]
# perspective y
- percents: [[1, 1], [0.5, 1]]
aligns: [[0, 0], [0, 0]]
# trapezoidate x
- weights: [1, 0, 1, 0]
percent: [0.75, 1]
align: [-1, 1]
# trapezoidate y
- weights: [0, 1, 0, 1]
percent: [0.5, 1]
align: [-1, 1]
# skew x
- weights: [1, 0]
angle: [0, 30]
ccw: 0.5
# skew y
- weights: [0, 1]
angle: [0, 10]
ccw: 0.5
# rotate
- angle: [0, 10]
ccw: 0.5
pad:
prob: 1
args:
pxs: [[0, 10], [0, 10], [0, 10], [0, 10]]
postprocess:
args:
# gaussian noise
- prob: 1
args:
scale: [4, 8]
per_channel: 0
# gaussian blur
- prob: 0.9
args:
sigma: [0, 2]
# resample
- prob: 0.1
args:
size: [0.4, 0.4]
# median blur
- prob: 1
args:
k: [1, 1]
Please change this line.
from
corpus:
weights: [1]
to
corpus:
weights: [1, 0]
Please change this line.
from
corpus: weights: [1]
to
corpus: weights: [1, 0]
Thank you soo much it worked
Also it gives this error can we prevent this
RuntimeError: Text is not visible