#!/usr/bin/env python2 from __future__ import division from __future__ import with_statement from __future__ import print_function import subprocess import pipes import sys import dmt if __name__=='__main__': args=sys.argv[1:] if not os.path.exists(args[0]): subprocess.check_call(['rsync','-avzP','mrmaster:/isis2b/git/deepmanifold/{}'.format(args[0]),'.']) dmt.reconstruct_traversal(args[0],0)
test_ipath = [L[i] for i in test_indices] print('test_ipath',test_ipath) ipath = source_ipath + target_ipath + everything_else_ipath + test_ipath N = len(source_ipath) M = len(target_ipath) L = len(everything_else_ipath) if config['traversal_only']: # run this on high memory CPU # (you must have already extracted features) XF,F2,traversal=dmt.run(ipath,N,M,L,config['model'],config['image_dims'],config['device_id'],weights,rbf_var,prefix,config['num_iter'],config['hybrid'],config['zscore'],traversal_only=True) with open('{}_config.yaml'.format(os.path.splitext(traversal)[0]),'w') as f: f.write(yaml.dump(config)) elif config['reconstruct_only']: # run this on high memory GPU # (you must have already done traversal) traversal=config['reconstruct_only'] if not os.path.exists(traversal): # fetch traversal from high memory CPU machine subprocess.check_call(['rsync','-avzP','mrmaster:/isis2b/git/deepmanifold/{}'.format(traversal),'.']) subprocess.check_call(['rsync','-avzP','mrmaster:/isis2b/git/deepmanifold/{}_config.yaml'.format(os.path.splitext(traversal)[0]),'.']) XF,F2,root_dir,result=dmt.reconstruct_traversal(traversal,config['device_id']) shutil.copy('{}_config.yaml'.format(os.path.splitext(traversal)[0]),'{}/config.yaml'.format(root_dir)) else: # run this on high memory CPU+GPU # (will also extract features, if needed) XF,F2,root_dir,result=dmt.run(ipath,N,M,L,config['model'],config['image_dims'],config['device_id'],weights,rbf_var,prefix,config['num_iter'],config['hybrid'],config['zscore']) with open('{}/config.yaml'.format(root_dir),'w') as f: f.write(yaml.dump(config))