def clean_words(words): lc = BasicLocale() for i, w in enumerate(words): try: words[i] = lc.represent(w).encode('ascii', errors='ignore') except: words[i] = w return words
import cv2 import math import os import tensorflow as tf from datetime import datetime from alexnet import AlexNet from datagenerator import ImageDataGenerator from tensorflow.contrib.data import Iterator import string from strlocale import BasicLocale # set random seed tf.set_random_seed(1234) # set up object for string's unicode conversion lc = BasicLocale() # global constants VGG_MEAN = np.asarray([103.939, 116.779, 123.68]) sess = None score = None #tf.logging.set_verbosity(tf.logging.ERROR) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # necessary placeholders for tensorflow sessions x = tf.placeholder(tf.float32, [1, 227, 227, 3]) #y = tf.placeholder(tf.float32, [None, 36]) keep_prob = tf.placeholder(tf.float32) ################################################################