print(colored("Image save in {}".format(imagePath), 'green')) elif pred_data_from == 'zed': helper.read_zed(sess, image_shape, logits, keep_prob, input_image) if __name__ == '__main__': (disable_gpu, pred_data_from, path_model, path_data, num_classes, epochs, batch_size, vgg_dir, learn_rate, log_dir, data_dir, graph_visualize, glob_trainig_images_path, glob_labels_trainig_image_path) = helper.get_args() if not path_model: all_is_ok() run() else: predict_by_model() if graph_visualize: print("\n\nConverting .pb file to TF Summary and Saving Visualization of VGG16 graph..............") graph_visualize()
def deploy(schema_path, nids, exps, runfiles, fmt): nid = iter(nids[env.host]) exp = iter(exps[env.host]) runfile = iter(runfiles[env.host]) succeeded = True with shell_env(SCHEMA_PATH=schema_path): with settings(warn_only=True, command_timeout=MAX_TIME_PER_EXP): # if env.same_node: cmd = '' for r in env.roledefs["servers"]: if r == env.host: nn = nid.next() rfile = runfile.next() args = get_args(fmt, exp.next()) if env.shmem: cmd += "(/dev/shm/{}rundb -nid{} {}>> /dev/shm/results{}.out 2>&1 &);".format( rfile, nn, args, nn) # cmd += "(/dev/shm/rundb -nid{} >> /dev/shm/results{}.out 2>&1 &);".format(nn,nn) else: cmd += "(./{}rundb -nid{} {}>> results{}.out 2>&1 &);".format( rfile, nn, args, nn) for r in env.roledefs["clients"]: if r == env.host: nn = nid.next() rfile = runfile.next() args = get_args(fmt, exp.next()) if env.shmem: cmd += "(/dev/shm/{}runcl -nid{} {}>> /dev/shm/results{}.out 2>&1 &);".format( rfile, nn, args, nn) else: cmd += "(./{}runcl -nid{} {}>> results{}.out 2>&1 &);".format( rfile, nn, args, nn) # for r in env.roledefs["sequencer"]: # if r == env.host: # nn = nid.next() # args = get_args(fmt,exp.next()) # if env.shmem: # cmd += "(/dev/shm/runsq -nid{} {}>> /dev/shm/results{}.out 2>&1 &);".format(nn,args,nn) # else: # cmd += "(./runsq -nid{} {}>> results{}.out 2>&1 &);".format(nn,args,nn) cmd = cmd[:-3] cmd += ")" try: res = run("echo $SCHEMA_PATH") if not env.dry_run: run(cmd) else: print(cmd) except CommandTimeout: pass except NetworkError: pass # else: # if env.host in env.roledefs["servers"]: # nn = nid.next(); # cmd = "./rundb -nid{} >> results{}.out 2>&1".format(nn,nn) # elif env.host in env.roledefs["clients"]: # nn = nid.next(); # cmd = "./runcl -nid{} >> results{}.out 2>&1".format(nn,nn) # elif "sequencer" in env.roledefs and env.host in env.roledefs["sequencer"]: # nn = nid.next(); # cmd = "./runsq -nid{} >> results{}.out 2>&1".format(nn,nn) # else: # with color('error'): # puts("host does not belong to any roles",show_prefix=True) # puts("current roles:",show_prefix=True) # puts(pprint.pformat(env.roledefs,depth=3),show_prefix=False) # # try: # res = run("echo $SCHEMA_PATH") # if not env.dry_run: # run(cmd) # except CommandTimeout: # pass # except NetworkError: # pass return True
#!/usr/bin/env python3 import tensorflow as tf import numpy as np import time import sys import helper import vgg16 args = helper.get_args(description='Extract VGG16 features') helper.setup(args) batch_size = args.batch_size with tf.Session() as sess: vgg = vgg16.Vgg16() images = tf.placeholder("float", [None, 224, 224, 3]) vgg.build(images) LAYERS_TO_EXTRACT = helper.get_vgg_layers_to_be_extracted( vgg, args.extract_layers) for img_paths, imgs in helper.next_img_batch( count=batch_size, done_file=args.done_file, images_file=args.images_list_file, prepend_image_path=args.images_path): time_start = time.time() features = sess.run(LAYERS_TO_EXTRACT, feed_dict={images: imgs})
def deploy(schema_path,nids,exps,runfiles,fmt): nid = iter(nids[env.host]) exp = iter(exps[env.host]) runfile = iter(runfiles[env.host]) succeeded = True with shell_env(SCHEMA_PATH=schema_path): with settings(warn_only=True,command_timeout=MAX_TIME_PER_EXP): # if env.same_node: cmd = '' for r in env.roledefs["servers"]: if r == env.host: nn = nid.next() rfile = runfile.next() args = get_args(fmt,exp.next()) if env.shmem: cmd += "(/dev/shm/{}rundb -nid{} {}>> /dev/shm/results{}.out 2>&1 &);".format(rfile,nn,args,nn) # cmd += "(/dev/shm/rundb -nid{} >> /dev/shm/results{}.out 2>&1 &);".format(nn,nn) else: cmd += "(./{}rundb -nid{} {}>> results{}.out 2>&1 &);".format(rfile,nn,args,nn) for r in env.roledefs["clients"]: if r == env.host: nn = nid.next() rfile = runfile.next() args = get_args(fmt,exp.next()) if env.shmem: cmd += "(/dev/shm/{}runcl -nid{} {}>> /dev/shm/results{}.out 2>&1 &);".format(rfile,nn,args,nn) else: cmd += "(./{}runcl -nid{} {}>> results{}.out 2>&1 &);".format(rfile,nn,args,nn) # for r in env.roledefs["sequencer"]: # if r == env.host: # nn = nid.next() # args = get_args(fmt,exp.next()) # if env.shmem: # cmd += "(/dev/shm/runsq -nid{} {}>> /dev/shm/results{}.out 2>&1 &);".format(nn,args,nn) # else: # cmd += "(./runsq -nid{} {}>> results{}.out 2>&1 &);".format(nn,args,nn) cmd = cmd[:-3] cmd += ")" try: res = run("echo $SCHEMA_PATH") if not env.dry_run: run(cmd) else: print(cmd) except CommandTimeout: pass except NetworkError: pass # else: # if env.host in env.roledefs["servers"]: # nn = nid.next(); # cmd = "./rundb -nid{} >> results{}.out 2>&1".format(nn,nn) # elif env.host in env.roledefs["clients"]: # nn = nid.next(); # cmd = "./runcl -nid{} >> results{}.out 2>&1".format(nn,nn) # elif "sequencer" in env.roledefs and env.host in env.roledefs["sequencer"]: # nn = nid.next(); # cmd = "./runsq -nid{} >> results{}.out 2>&1".format(nn,nn) # else: # with color('error'): # puts("host does not belong to any roles",show_prefix=True) # puts("current roles:",show_prefix=True) # puts(pprint.pformat(env.roledefs,depth=3),show_prefix=False) # # try: # res = run("echo $SCHEMA_PATH") # if not env.dry_run: # run(cmd) # except CommandTimeout: # pass # except NetworkError: # pass return True
#!/usr/bin/env python #-*- coding:utf-8 -*- # author: GZhao_zhaoguanzhi # datetime: 2019/8/29 5:42 PM # software: PyCharm import os import warnings from helper import get_args from tfnlp.utils.common import import_object warnings.filterwarnings('ignore') args = get_args() if True: import sys param_str = '\n'.join( ['%20s = %s' % (k, v) for k, v in sorted(vars(args).items())]) print('usage: %s\n%20s %s\n%s\n%s\n' % (' '.join(sys.argv), 'ARG', 'VALUE', '_' * 50, param_str)) # os.environ['CUDA_VISIBLE_DEVICES'] = args.device_map task = import_object(args.task_py, args.task_class)() task.load(args.conf_path) if args.task == 'train': task.train() elif args.task == 'test': task.test() else:
import helper OUTPUT_DIR_NAME = "DnsLibs" COPIED_FILES = [ "Adguard.Dns.dll", "Adguard.Dns.pdb", "AdguardDns.dll", "AdguardDns.pdb" ] if __name__ == '__main__': try: print("Starting AdguardDns post build event script") args = helper.get_args() helper.copy_to_output(args, COPIED_FILES, OUTPUT_DIR_NAME) print( "Adguard post build event script has been completed successfully") except Exception as ex: print(f"Adguard post build event script failed with an error {ex}") raise