示例#1
0
from chainer import cuda
from chainer import serializers

## 初期値設定
original_image_size = 110  #画像サイズ
thresh = 127
batch_size = 100
dropout_ratio = 0.1
gpu_flag = 0
epochs = 10000000

if gpu_flag >= 0:
    cuda.check_cuda_available()
xp = cuda.cupy if gpu_flag >= 0 else np

functions = ocr_functionset.functions()

## 画像回転用定数を外に出しておく
image_size = tuple([original_image_size, original_image_size])
image_center = tuple([int(image_size[0] / 2), int(image_size[1] / 2)])
image_scale = 1.0

## 学習データセット読み込み

code2num = pickle.load(open('code2num_new.pkl', 'rb'))
num2code = pickle.load(open('num2code_new.pkl', 'rb'))
dataset = {}

for i in range(0, 14):
    fname = "dataset" + str(i) + "_new.pkl"
    dictionary = pickle.load(open(fname, "rb"))
示例#2
0
 def __init__(self, image_path):
     self.functions = ocr_functionset.functions()
     self.image_path = image_path