(db, split, testiter, debug=False, suffix=None)
| 37 | os.makedirs(directory) |
| 38 | |
| 39 | def test(db, split, testiter, debug=False, suffix=None): |
| 40 | result_dir = system_configs.result_dir |
| 41 | result_dir = os.path.join(result_dir, str(testiter), split) |
| 42 | |
| 43 | if suffix is not None: |
| 44 | result_dir = os.path.join(result_dir, suffix) |
| 45 | |
| 46 | make_dirs([result_dir]) |
| 47 | |
| 48 | test_iter = system_configs.max_iter if testiter is None else testiter |
| 49 | print("loading parameters at iteration: {}".format(test_iter)) |
| 50 | |
| 51 | print("building neural network...") |
| 52 | nnet = NetworkFactory(db) |
| 53 | print("loading parameters...") |
| 54 | nnet.load_params(test_iter) |
| 55 | |
| 56 | test_file = "test.{}".format(db.data) |
| 57 | testing = importlib.import_module(test_file).testing |
| 58 | |
| 59 | nnet.cuda() |
| 60 | nnet.eval_mode() |
| 61 | testing(db, nnet, result_dir, debug=debug) |
| 62 | |
| 63 | if __name__ == "__main__": |
| 64 | args = parse_args() |
no test coverage detected