Welcome to crnn.gluon’s documentation!

crnn.gluon

config module

convert_rec module

crnn module

class crnn.BidirectionalGRU(hidden_size, num_layers, nOut)[源代码]

基类:mxnet.gluon.block.HybridBlock

__init__(hidden_size, num_layers, nOut)[源代码]

Initialize self. See help(type(self)) for accurate signature.

hybrid_forward(F, x, *args, **kwargs)[源代码]

Overrides to construct symbolic graph for this Block.

x : Symbol or NDArray
The first input tensor.
*args : list of Symbol or list of NDArray
Additional input tensors.
class crnn.BidirectionalLSTM(hidden_size, num_layers, nOut)[源代码]

基类:mxnet.gluon.block.HybridBlock

__init__(hidden_size, num_layers, nOut)[源代码]

Initialize self. See help(type(self)) for accurate signature.

hybrid_forward(F, x, *args, **kwargs)[源代码]

Overrides to construct symbolic graph for this Block.

x : Symbol or NDArray
The first input tensor.
*args : list of Symbol or list of NDArray
Additional input tensors.
class crnn.CRNN(n_class, hidden_size=256, num_layers=1)[源代码]

基类:mxnet.gluon.block.HybridBlock

__init__(n_class, hidden_size=256, num_layers=1)[源代码]

Initialize self. See help(type(self)) for accurate signature.

hybrid_forward(F, x, *args, **kwargs)[源代码]

Overrides to construct symbolic graph for this Block.

x : Symbol or NDArray
The first input tensor.
*args : list of Symbol or list of NDArray
Additional input tensors.
class crnn.Decoder(n_class, hidden_size=256, num_layers=1)[源代码]

基类:mxnet.gluon.block.HybridBlock

__init__(n_class, hidden_size=256, num_layers=1)[源代码]

Initialize self. See help(type(self)) for accurate signature.

hybrid_forward(F, x, *args, **kwargs)[源代码]

Overrides to construct symbolic graph for this Block.

x : Symbol or NDArray
The first input tensor.
*args : list of Symbol or list of NDArray
Additional input tensors.
class crnn.DenseNet[源代码]

基类:mxnet.gluon.block.HybridBlock

__init__()[源代码]

Initialize self. See help(type(self)) for accurate signature.

hybrid_forward(F, x, *args, **kwargs)[源代码]

Overrides to construct symbolic graph for this Block.

x : Symbol or NDArray
The first input tensor.
*args : list of Symbol or list of NDArray
Additional input tensors.
class crnn.Encoder[源代码]

基类:mxnet.gluon.block.HybridBlock

__init__()[源代码]

Initialize self. See help(type(self)) for accurate signature.

hybrid_forward(F, x, *args, **kwargs)[源代码]

Overrides to construct symbolic graph for this Block.

x : Symbol or NDArray
The first input tensor.
*args : list of Symbol or list of NDArray
Additional input tensors.
class crnn.ResNet[源代码]

基类:mxnet.gluon.block.HybridBlock

__init__()[源代码]

Initialize self. See help(type(self)) for accurate signature.

hybrid_forward(F, x, *args, **kwargs)[源代码]

Overrides to construct symbolic graph for this Block.

x : Symbol or NDArray
The first input tensor.
*args : list of Symbol or list of NDArray
Additional input tensors.
class crnn.VGG[源代码]

基类:mxnet.gluon.block.HybridBlock

__init__()[源代码]

Initialize self. See help(type(self)) for accurate signature.

hybrid_forward(F, x, *args, **kwargs)[源代码]

Overrides to construct symbolic graph for this Block.

x : Symbol or NDArray
The first input tensor.
*args : list of Symbol or list of NDArray
Additional input tensors.

dataset module

class dataset.ImageDataset(data_txt: str, data_shape: tuple, img_channel: int, num_label: int, alphabet: str, phase: str = 'train')[源代码]

基类:mxnet.gluon.data.dataset.Dataset

__init__(data_txt: str, data_shape: tuple, img_channel: int, num_label: int, alphabet: str, phase: str = 'train')[源代码]

数据集初始化

参数:
  • data_txt – 存储着图片路径和对于label的文件
  • data_shape – 图片的大小(h,w)
  • img_channel – 图片通道数
  • num_label – 最大字符个数,应该和网络最终输出的序列宽度一样
  • alphabet – 字母表
label_enocder(label)[源代码]

对label进行处理,将输入的label字符串转换成在字母表中的索引

参数:label – label字符串
返回:索引列表
pre_processing(img_path)[源代码]

对图片进行处理,先按照高度进行resize,resize之后如果宽度不足指定宽度,就补黑色像素,否则就强行缩放到指定宽度

参数:img_path – 图片地址
返回:
class dataset.RecordDataset(filename, data_shape: tuple, img_channel: int, num_label: int)[源代码]

基类:mxnet.gluon.data.dataset.RecordFileDataset

A dataset wrapping over a RecordIO file contraining images Each sample is an image and its corresponding label

__init__(filename, data_shape: tuple, img_channel: int, num_label: int)[源代码]

Initialize self. See help(type(self)) for accurate signature.

label_enocder(label)[源代码]

对label进行处理,将输入的label字符串转换成在字母表中的索引

参数:label – label字符串
返回:索引列表
pre_processing(img)[源代码]

对图片进行处理 :param img_path: 图片 :return:

keys module

predict module

class predict.GluonNet(model_path, alphabet, img_shape, net, img_channel=3, gpu_id=None)[源代码]

基类:object

__init__(model_path, alphabet, img_shape, net, img_channel=3, gpu_id=None)[源代码]

初始化gluon模型 :param model_path: 模型地址 :param alphabet: 字母表 :param img_shape: 图像的尺寸(w,h) :param net: 网络计算图,如果在model_path中指定的是参数的保存路径,则需要给出网络的计算图 :param img_channel: 图像的通道数: 1,3 :param gpu_id: 在哪一块gpu上运行

pre_processing(img_path)[源代码]

对图片进行处理,先按照高度进行resize,resize之后如果宽度不足指定宽度,就补黑色像素,否则就强行缩放到指定宽度 :param img_path: 图片地址 :return:

predict(img_path)[源代码]

对传入的图像进行预测,支持图像地址和numpy数组 :param img_path: 图像地址 :return:

predict.decode(preds, alphabet, raw=False)[源代码]
predict.try_gpu(gpu)[源代码]

If GPU is available, return mx.gpu(0); else return mx.cpu()

train module

train.accuracy(predictions, labels, alphabet)[源代码]
train.evaluate_accuracy(net, dataloader, ctx, alphabet)[源代码]
train.setup_logger(log_file_path: str = None)[源代码]
train.train()[源代码]

Indices and tables