コード例 #1
0
parser.add_argument("-gpu_i",
                    "--gpu_index",
                    type=str,
                    default="0",
                    help="gpu index")
args = parser.parse_args()

# IF YOU USE GPU UNCOMMENT NEXT LINES:
# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu_index

# define experiment path
EXPERIMENT_NAME = args.experiment_name
EXPERIMENT_DIR = OCR_EXPERIMENTS_DIR / EXPERIMENT_NAME

CV_CONFIG = Config(CONFIG_PATH)

MODEL_PARAMS = {
    "nn_module": (
        "CRNN",
        {
            'image_height': CV_CONFIG.get('ocr_image_size')
            [0],  #As far as h == 1, image height must be equal 16
            'number_input_channels': CV_CONFIG.get(
                'model_image_ch'),  #3 for color image and 1 for gray scale
            'number_class_symbols':
            len(CV_CONFIG.get('alphabet')) + 1,  #Length of alphabet
            'rnn_size':
            CV_CONFIG.get('model_rnn_size'
                          ),  # time length of rnn layer, 64|128|256 and so on
        }),
コード例 #2
0
parser.add_argument("-gpu_i",
                    "--gpu_index",
                    type=str,
                    default="0",
                    help="gpu index")
args = parser.parse_args()

# IF YOU USE GPU UNCOMMENT NEXT LINES:
#os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
#os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu_index

# define experiment path
EXPERIMENT_NAME = args.experiment_name
EXPERIMENT_DIR = OCR_EXPERIMENTS_DIR / EXPERIMENT_NAME

CV_CONFIG = Config(CONFIG_PATH)

DATASET_PATH = CV_CONFIG.data['data_path']

# CHANGE YOUR BATCH SIZE
BATCH_SIZE = 16
# 400 EPOCH SHOULD BE ENOUGH
NUM_EPOCHS = 100

alphabet = " "
alphabet += string.ascii_uppercase
alphabet += "".join([str(i) for i in range(10)])

MODEL_PARAMS = {
    "image_height": 32,
    "number_input_channels": 3,
コード例 #3
0
parser.add_argument("-en",
                    "--experiment_name",
                    help="Save folder name",
                    required=True)
parser.add_argument("-gpu_i",
                    "--gpu_index",
                    type=str,
                    default="0",
                    help="gpu index")
args = parser.parse_args()

# define experiment path
EXPERIMENT_NAME = args.experiment_name
EXPERIMENT_DIR = OCR_EXPERIMENTS_DIR / EXPERIMENT_NAME

CV_CONFIG = Config(CONFIG_PATH)

DATASET_PATHS = [Path(CV_CONFIG.get("data_path"))]
# CHANGE YOUR BATCH SIZE
BATCH_SIZE = 64
# 400 EPOCH SHOULD BE ENOUGH
NUM_EPOCHS = 400

alphabet = "ABEKMHOPCTYX"
alphabet += "".join([str(i) for i in range(10)])
alphabet += "-"

MODEL_PARAMS = {"nn_module":
                    ("CRNN", { #DEFINE PARAMS OF YOUR MODEL
                        'image_height' : CV_CONFIG.get("ocr_image_size")[0],
                        'number_input_channels' : CV_CONFIG.get("num_input_channels"),
コード例 #4
0
parser.add_argument("-gpu_i",
                    "--gpu_index",
                    type=str,
                    default="0",
                    help="gpu index")
args = parser.parse_args()

# IF YOU USE GPU UNCOMMENT NEXT LINES:
# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu_index

# define experiment path
EXPERIMENT_NAME = args.experiment_name
EXPERIMENT_DIR = OCR_EXPERIMENTS_DIR / EXPERIMENT_NAME

CV_CONFIG = Config(CONFIG_PATH)

DATASET_PATHS = [Path(CV_CONFIG.get("data_path"))]
# CHANGE YOUR BATCH SIZE
BATCH_SIZE = 100
# 400 EPOCH SHOULD BE ENOUGH
NUM_EPOCHS = 1500  #400

MODEL_PARAMS = {
    "nn_module": (
        "CRNN",
        {
            'image_height': CV_CONFIG.get("ocr_image_size")
            [0],  #As far as h == 1, image height must be equal 16
            'number_input_channels': CV_CONFIG.get(
                "model_image_ch"),  #3 for color image and 1 for gray scale
コード例 #5
0
parser.add_argument("-gpu_i",
                    "--gpu_index",
                    type=str,
                    default="0",
                    help="gpu index")
args = parser.parse_args()

# IF YOU USE GPU UNCOMMENT NEXT LINES:
# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu_index

# define experiment path
EXPERIMENT_NAME = args.experiment_name
EXPERIMENT_DIR = OCR_EXPERIMENTS_DIR / EXPERIMENT_NAME

CV_CONFIG = Config(CONFIG_PATH)

DATASET_PATHS = [Path(CV_CONFIG.get("data_path"))]
# CHANGE YOUR BATCH SIZE
BATCH_SIZE = 32
# 400 EPOCH SHOULD BE ENOUGH
NUM_EPOCHS = 400

alphabet = "-ABEKMHOPCTYX" + "0123456789"

MODEL_PARAMS = {
    "nn_module": ("CRNN", {
        "image_height": CV_CONFIG.get("model_image_height"),
        "number_input_channels": CV_CONFIG.get("model_image_ch"),
        "number_class_symbols": len(alphabet),
        "rnn_size": CV_CONFIG.get("model_rnn_size")