def convIMG(address, DIR = "_imgswork"): imgaddress = DIR+address print(imgaddress) # データを読み込んで28x28に縮小 img, altfilename, frame, flag = openCVmod.FaceRecognition(imgaddress, isShow = False, saveStyle = '', workDIR = '') img = cv2.resize(img, (28, 28)) return img.astype(np.float32)/255.0
def convIMG(address, DIR = "_imgswork"): imgaddress = DIR+address print(imgaddress) recogresult = openCVmod.FaceRecognition(imgaddress, isShow = False, saveStyle = '', workDIR = 'work', through = True) img = recogresult[0] img = openCVmod.adjustIMG(img, K = 0, isHC = True, size = (28, 28)) return img.flatten().astype(np.float32)/255.0
def predictAns(filename = "rin/show.png", isShow = True, model = '/Users/xxxx']): classifier = skflow.TensorFlowEstimator.restore(model) # imgaddress = "rin/images-10.jpeg" # imgaddress = '/Users/xxxx' img, altfilename, frame, FACEflag = openCVmod.FaceRecognition(filename, isShow = isShow, saveStyle = 'whole', workDIR = '') img = openCVmod.adjustIMG(img, isHC = True, K = 0, size = (28, 28)) result = classifier.predict(img) anslabel = label[result] return anslabel, FACEflag, altfilename
def predictAns(filename = "", isShow = True, model = '', workDIR = '', label =['ことり', 'にこ', '凛', '希', '海未', '真姫', '穂乃果', '絵里', '花陽']): classifier = skflow.TensorFlowEstimator.restore(model) img, altfilename, frame, FACEflag = openCVmod.FaceRecognition(filename, isShow = isShow, saveStyle = 'whole', workDIR = '') img = openCVmod.adjustIMG(img, isHC = True, K = 0, size = (28, 28)) result = classifier.predict(img) print(result) anslabel = label[result] return anslabel, FACEflag, altfilename
def preIMGprocess(DIR = "", workDIR = '_imgswork', processes = []): imgdics = getDeepPathDic(DIR) [openCVmod.FaceRecognition(filename = DIR+address, isShow = False, saveStyle = 'icon', workDIR = workDIR) for address, label in imgdics] workPATH = DIR + workDIR + '/' facedics = getDeepPathDic(workPATH) [openCVmod.IMGprocess(filename = workPATH+address, isSave = True, processes = processes) for address, label in facedics]
def convIMG(address, DIR = "_imgswork"): imgaddress = DIR+address print(imgaddress) img, altfilename, frame, flag = openCVmod.FaceRecognition(imgaddress, isShow = False, saveStyle = '', workDIR = '') img = openCVmod.adjustIMG(img, K = 64, size = (28, 28)) return img.flatten().astype(np.float32)/255.0