def index(): upload = request.files.get("files") path = "uploads/" + hashlib.sha256( os.urandom(16)).hexdigest()[:16] + ".png" upload.save(path) print("yes") return prediction.run()
def run(argv=None): if argv is None or argv[1] == 'prediction': prediction.run(argv[1:]) elif argv[1] == 'select': selection.run(argv[1:]) elif argv[1] == 'extract': extraction.run(argv[1:]) elif argv[1] == 'extract_UKBB_v1': extraction.run_UKBB_v1(argv[1:]) elif argv[1] == 'extract_UKBB_v2': extraction.run_UKBB_v2(argv[1:]) elif argv[1] == 'test_fit_time': test_fit_time.run(argv[1:]) elif argv[1] == 'stats': statistics.run(argv[1:]) else: raise ValueError(f'Unrecognized argument {argv[1]}')
def run_one(task, T): argv = { 'action': 'prediction', 'task_name': task, 'strategy_name': '0', 'T': str(T), 'RS': '0', 'dump_idx_only': True, 'n_top_pvals': 100, } # Only one trial for task having features manually selected (not _pvals) if '_pvals' not in task and T != 0: return args = Namespace(**argv) prediction.run(args)
def build_model(tech_list): run(tech_list)
def test_run(self): print "Test prediction required run TestServerMonitor.py and TestUserMonitor.py first" pr.run("MONITOR_TEST")
def stats(model, dataset): print(performance(model)) for i in range(2100): img, p, pose = dataset.__getitem__(i) run(model, img, i)
import torch import os from prediction import load, run, performance def stats(model, dataset): print(performance(model)) for i in range(2100): img, p, pose = dataset.__getitem__(i) run(model, img, i) # model, dataset = load("boxClassifier") # stats(model, dataset) model, dataset = load("boxClassifier") for i in range(20): img, p, pose = dataset.__getitem__(i) run(model, img, i)