from training import trainModel from HandwrittenScan import handwrittenScan import cv2 trainModelObj = trainModel() handwrittenScanObj = handwrittenScan() knn_Model = trainModelObj.trainAndTestKNN(kValue=3) inputPath = './input/002.jpg' img = cv2.imread(inputPath) result, mainImage, rect = handwrittenScanObj.extractPredictDigits( inputPath, knn_Model) handwrittenScanObj.displayDigit(result, mainImage, rect) cv2.waitKey(0) cv2.destroyAllWindows()
def train(): from training import trainModel message = trainModel() return jsonify(result=message)
print(' [7] --- Exit') print() # TODO: Flush input op = int(input('Select an option: ')) print() clear() try: if op == 1: print('Starting facial detection') facialDetection() elif op == 2: print('Starting facial recognition') facialDetection(mode=1) elif op == 3: print('Starting model training') trainModel() elif op == 4: print('MODEL PROFILES') profiles = loadProfiles() for key in profiles: print(f'{key} - {profiles[key]}') elif op == 5: addProfile() elif op == 6: removeProfile() elif op == 7: exit(0) else: print('Unvalid option') except AssertionError as Argument: print(
from enrollment import enroll from testing import testModel from training import trainModel success, userId = enroll() if success == True: trainModel(userId) testModel(userId) else: print('DUH')
import training import server import config import sys import os if __name__ == '__main__': port = int(sys.argv[1]) if not os.path.exists(config.TRAINED_MODEL_PATH): training.trainModel(config.TRAINED_MODEL_PATH) try: server.runServer(port) except: print("digitchecker server killed. Bye!")
import training import testing import analysis training.trainModel() testing.testModel() analysis.analysisMain()