def test_model(model_file, multi_gpu_testing, opts=None): # All arguments to inference functions are passed via cfg cfg.TEST.WEIGHTS = model_file # Clear memory before inference workspace.ResetWorkspace() # Run inference test_net.main(multi_gpu_testing=multi_gpu_testing)
def test_model(model_file, multi_gpu_testing, opts=None): """Test a model.""" # All arguments to inference functions are passed via cfg cfg.TEST.WEIGHTS = model_file # Clear memory before inference workspace.ResetWorkspace() # Run inference test_net.main(multi_gpu_testing=multi_gpu_testing)
'--imdb', TRAIN_IMDB, '--cfg', at_fcnn('experiments/cfgs/faster_rcnn_alt_opt.yml')] + ([] if not args.EXTRA_ARGS else ['--set'] + args.EXTRA_ARGS)) print 'tools/train_faster_rcnn_alt_opt.py finished in %s seconds' % (time.time() - start) # find the path to the snapshot in the log try: with open(LOG) as f: lines = f.readlines() # find a line that has these words line = next((line for line in reversed(lines) if 'Wrote snapshot to:' in line), None) print 'Taking this line from log to get the snapshot: %s' % line # the 4th word in this line is the name of the model NET_FINAL = line.split()[3] print 'Will test the output model at: %s' % NET_FINAL except: print 'Cant find "Wrote snapshot to:" line in LOG file.' print 'Log file: %s' % LOG sys.exit() # run testing start = time.time() test_net.main([ '--gpu', args.GPU, '--def', at_fcnn('models/%s/%s/faster_rcnn_alt_opt/faster_rcnn_test.pt' % (PT_DIR, args.NET)), '--net', NET_FINAL, '--imdb', TEST_IMDB, '--cfg', at_fcnn('experiments/cfgs/faster_rcnn_alt_opt.yml')] + \ ([] if not args.EXTRA_ARGS is not None else ['--set'] + args.EXTRA_ARGS)) print 'tools/test_net.py finished in %s seconds' % (time.time() - start)
print 'tools/train_net.py finished in %s seconds' % (time.time() - start) # find the path to the snapshot in the log try: with open(LOG) as f: lines = f.readlines() # find a line that has these words line = next( (line for line in reversed(lines) if 'Wrote snapshot to:' in line), None) print 'Taking this line from log to get the snapshot: %s' % line # the 4th word in this line is the name of the model NET_FINAL = line.split()[3] print 'Will test the output model at: %s' % NET_FINAL except: print 'Cant find "Wrote snapshot to:" line in LOG file.' print 'Log file: %s' % LOG sys.exit() # run testing start = time.time() test_net.main([ '--gpu', args.GPU, '--def', at_fcnn('models/%s/%s/faster_rcnn_end2end/test.prototxt' % (PT_DIR, args.NET)), '--net', NET_FINAL, '--imdb', TEST_IMDB, '--cfg', at_fcnn('experiments/cfgs/faster_rcnn_end2end.yml')] + \ ([] if not args.EXTRA_ARGS is not None else ['--set'] + args.EXTRA_ARGS)) print 'tools/test_net.py finished in %s seconds' % (time.time() - start)
def test_model(model_file, multi_gpu_testing, opts=None): """Test a model.""" # Clear memory before inference workspace.ResetWorkspace() # Run inference test_net.main(model_file, multi_gpu_testing=multi_gpu_testing)