import tensorflow as tf import os.path as ops import numpy as np import cv2 import argparse import matplotlib.pyplot as plt try: from cv2 import cv2 except ImportError: pass from crnn_model import crnn_model from global_configuration import config from local_utils import log_utils, data_utils logger = log_utils.init_logger() def init_args(): """ :return: """ parser = argparse.ArgumentParser() parser.add_argument('--image_path', type=str, help='Where you store the image', default='data/test_images/test_01.jpg') parser.add_argument('--weights_path', type=str, help='Where you store the weights', default='model/shadownet/shadownet_2017-09-29-19-16-33.ckpt-39999') return parser.parse_args()
"""Train shadow net script.""" import os import os.path as ops import time import numpy as np import tensorflow as tf from crnn_model.crnn_model import ShadowNet from global_configuration import config from local_utils.data_utils import TextFeatureIO from local_utils.log_utils import init_logger logger = init_logger() def train_shadownet(dataset_dir, weights_path=None): """Train the CRNN. Parameters ---------- dataset_dir : str Where the dataset is saved. weights_path : None or string Where to save the model: if None: train from scratch if string: restore from checkpoint. Returns ------- None """