This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pylint: disable=C0111,too-many-arguments,too-many-instance-attributes,too-many-locals,redefined-outer-name,fixme | |
# pylint: disable=superfluous-parens, no-member, invalid-name | |
import sys, datetime, math, random | |
sys.path.insert(0, "../../python") | |
import mxnet as mx | |
import numpy as np | |
from io import BytesIO | |
class Batch(object): | |
def __init__(self, data_names, data, label_names, label): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pylint: disable=C0111,too-many-arguments,too-many-instance-attributes,too-many-locals,redefined-outer-name,fixme | |
# pylint: disable=superfluous-parens, no-member, invalid-name | |
import sys | |
sys.path.insert(0, "../../python") | |
import mxnet as mx | |
import numpy as np | |
import cv2, random | |
from io import BytesIO | |
from captcha.image import ImageCaptcha |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//used for training | |
def bi_lstm_unroll(seq_len, input_size,num_hidden, num_embed, num_label, dropout=0.): | |
embed_weight = mx.sym.Variable("embed_weight") | |
cls_weight = mx.sym.Variable("cls_weight") | |
cls_bias = mx.sym.Variable("cls_bias") | |
last_states = [] | |
last_states.append(LSTMState(c = mx.sym.Variable("l0_init_c"), h = mx.sym.Variable("l0_init_h"))) | |
last_states.append(LSTMState(c = mx.sym.Variable("l1_init_c"), h = mx.sym.Variable("l1_init_h"))) | |
forward_param = LSTMParam(i2h_weight=mx.sym.Variable("l0_i2h_weight"), |