- -h, --help show this help message and exit
- --output_dir [OUTPUT_DIR] The output directory
- -i [INPUT_FILE], --input_file [INPUT_FILE]
When set, this argument uses a specified text file as source for the text
设置后,此参数使用指定的文本文件作为文本的源
- -l [LANGUAGE], --language [LANGUAGE]
The language to use, should be fr (French), en(English), es (Spanish), de (German), ar (Arabic), cn(Chinese), or hi (Hindi)
- -c [COUNT], --count [COUNT]
The number of images to be created.
- -rs, --random_sequences
Use random sequences as the source text for the generation. Set '-let','-num','-sym' to use letters/numbers/symbols. If none specified, using all three.
使用随机序列作为生成的源文本。设置“ -let”,“-num”,“-sym”以使用字母/数字/符号。如果未指定,则全部使用这三个。
>>-let, --include_letters
Define if random sequences should contain letters.Only works with -rs
>>-num, --include_numbers
Define if random sequences should contain numbers.Only works with -rs
>>-sym, --include_symbols
Define if random sequences should contain symbols.Only works with -rs
- -w [LENGTH], --length [LENGTH]
Define how many words should be included in each generated sample. If the text source is Wikipedia,this is the MINIMUM length
定义每个生成的样本中应包含多少个单词。如果文字来源是Wikipedia,则这是最小长度
- -r, --random
Define if the produced string will have variable word count (with --length being the maximum)
定义产生的字符串是否具有可变的字数(以--length为最大值)
- -f [FORMAT], --format [FORMAT]
Define the height of the produced images if horizontal, else the width
如果水平,则定义生成图像的高度,否则,定义宽度
- -t [THREAD_COUNT], --thread_count [THREAD_COUNT]
Define the number of thread to use for image generation
定义用于生成图像的线程数
- -e [EXTENSION], --extension [EXTENSION]
Define the extension to save the image with -k [SKEW_ANGLE],--skew_angle [SKEW_ANGLE]
Define skewing angle of the generated text. In positive degrees
定义扩展名以使用-k [SKEW_ANGLE],-skew_angle [SKEW_ANGLE]保存图像
定义生成文本的倾斜角度。正向
- -rk, --random_skew When set, the skew angle will be randomized between the value set with -k and it's opposite
设置后,偏斜角将在-k设置的值与相反的值之间随机化
- -wk, --use_wikipedia Use Wikipedia as the source text for the generation,using this paremeter ignores -r, -n, -s
使用Wikipedia作为生成的源文本,使用此参数忽略-r,-n,-s
- -bl [BLUR], --blur [BLUR]
Apply gaussian blur to the resulting sample. Should be an integer defining the blur radius
对结果样本应用高斯模糊。应该是定义模糊半径的整数
- -rbl, --random_blur When set, the blur radius will be randomized between 0 and -bl.
设置后,模糊半径将在0到-bl之间随机分配。
- -b [BACKGROUND], --background [BACKGROUND]
Define what kind of background to use. 0: Gaussian Noise, 1: Plain white, 2: Quasicrystal, 3: Image
定义要使用的背景类型。 0:高斯噪声; 1:纯白色; 2:准晶体; 3:图像
- -hw, --handwritten Define if the data will be "handwritten" by an RNN定义数据是否将由RNN“手写”
- -na NAME_FORMAT, --name_format NAME_FORMAT
Define how the produced files will be named. 0:[TEXT]_[ID].[EXT], 1: [ID]_[TEXT].[EXT] 2: [ID].[EXT]+ one file labels.txt containing id-to-label mappings
定义产生的文件的命名方式。 0:[TEXT] _ [ID]。[EXT],1:[ID] _ [TEXT]。[EXT] 2:[ID]。[EXT] +一个文件ID.txt,其中包含ID到标签的映射
- -om OUTPUT_MASK, --output_mask OUTPUT_MASK
Define if the generator will return masks for the text
定义生成器是否将返回文本的掩码
- -d [DISTORSION], --distorsion [DISTORSION]
Define a distorsion applied to the resulting image. 0:None (Default), 1: Sine wave, 2: Cosine wave, 3:Random
定义应用于结果图像的变形。 0:无(默认),1:正弦波,2:余弦波,3:随机
- -do [DISTORSION_ORIENTATION], --distorsion_orientation [DISTORSION_ORIENTATION]
Define the distorsion's orientation. Only used if -d is specified. 0: Vertical (Up and down), 1: Horizontal(Left and Right), 2: Both
定义变形的方向。仅在指定-d时使用。 0:垂直(上下),1:水平(左,右),2:同时
- -wd [WIDTH], --width [WIDTH]
Define the width of the resulting image. If not set it will be the width of the text + 10. If the width of the generated text is bigger that number will be used
定义结果图像的宽度。如果未设置,则为文本的宽度+10。如果生成的文本的宽度较大,则使用该数字
- -al [ALIGNMENT], --alignment [ALIGNMENT]
Define the alignment of the text in the image. Only used if the width parameter is set. 0: left, 1:center, 2: right
定义图像中文本的对齐方式。仅在设置width参数时使用。 0:左,1:中,2:右
- -or [ORIENTATION], --orientation [ORIENTATION]
Define the orientation of the text. 0: Horizontal, 1:Vertical
定义文本的方向。 0:水平; 1:垂直
- -tc [TEXT_COLOR], --text_color [TEXT_COLOR]
Define the text's color, should be either a single hex color or a range in the ?,? format.
定义文本的颜色,应为单个十六进制颜色或?,?中的范围。格式。
- -sw [SPACE_WIDTH], --space_width [SPACE_WIDTH]
Define the width of the spaces between words. 2.0 means twice the normal space width
定义单词之间空格的宽度。 2.0表示正常宽度的两倍
- -cs [CHARACTER_SPACING], --character_spacing [CHARACTER_SPACING]
Define the width of the spaces between characters. 2 means two pixels
定义字符之间的空格宽度。 2表示两个像素
- -m [MARGINS], --margins [MARGINS]
Define the margins around the text when rendered. In pixels
渲染时定义文本周围的边距。以像素为单位
- -fi, --fit
Apply a tight crop around the rendered text
在渲染的文本周围应用紧裁
- -ft [FONT], --font [FONT]
Define font to be used定义要使用的字体
- -fd [FONT_DIR], --font_dir [FONT_DIR]
Define a font directory to be used
定义要使用的字体目录
- -id [IMAGE_DIR], --image_dir [IMAGE_DIR]
Define an image directory to use when background is set to image
定义背景设置为图像时要使用的图像目录
- -ca [CASE], --case [CASE]
Generate upper or lowercase only. arguments: upper or lower. Example: --case upper
仅生成大写或小写。参数:上限或下限。示例:--case upper
- -dt [DICT], --dict [DICT]
Define the dictionary to be used
定义要使用的字典
- -ws, --word_split
Split on words instead of on characters (preserves ligatures, no character spacing)
分割单词而不是字符(保留连字,不留字符间距)
- -stw [STROKE_WIDTH], --stroke_width [STROKE_WIDTH]
Define the width of the strokes
定义笔划的宽度
- -stf [STROKE_FILL], --stroke_fill [STROKE_FILL]
Define the color of the contour of the strokes, if stroke_width is bigger than 0
如果stroke_width大于0,则定义笔触轮廓的颜色
- -im [IMAGE_MODE], --image_mode [IMAGE_MODE]
Define the image mode to be used. RGB is default, L means 8-bit grayscale images, 1 means 1-bit binary images stored with one pixel per byte, etc.
定义要使用的图像模式。默认为RGB,L表示8位灰度图像,1表示1位二进制图像,每字节存储一个像素,等等。
例:
python run.py -i text1.txt -l cn -c 31 -d 0 -b 0 -w 20 -bl 1 -rbl -tc '#000000,#888888' -f 64 -t 32 --output_dir 'text1-out'
- -l cn: language 为中文
- -i text1.txt 输入文档。具体的文本内容文件,文件中是一行行的文本,可以指定生成的图片内容;
- -c 31: 生成31张图
- -d 0: 文字按正弦函数曲线分布(0为不弯曲,1为sin,2为cos)
- -w 20每个生成的样本中包含多少个字
- -b 3: 背景图像从pictures文件夹中的图像上随机截取(0为高斯白噪声背景,1为白色背景,2为quasicrystal,3为自定义图片)
- -bl 1 -rbl: 随机模糊,1为模糊的kernel size
- -tc '#000000, #888888': 颜色变化区间
- -f 64: 水平分布文字图像的高(像素64)
- -t 32 32个线程
- --output_dir 'text1-out': 输出文件夹
python3 run.py -c 10 -k 15 -rk -bl 0.5 -rbl -tc '#000000,#888888'
生成10个示例,这些示例的倾斜角度在-15和15之间,并且高斯模糊在0和0.1之间。最后,应在黑色和灰色之间随机选择文本颜色(包括中间的所有颜色)。