Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
###### related DIRs on CNS to store results #######
discovered_concepts_dir = os.path.join(args.working_dir, 'concepts/')
results_dir = os.path.join(args.working_dir, 'results/')
cavs_dir = os.path.join(args.working_dir, 'cavs/')
activations_dir = os.path.join(args.working_dir, 'acts/')
results_summaries_dir = os.path.join(args.working_dir, 'results_summaries/')
if tf.gfile.Exists(args.working_dir):
tf.gfile.DeleteRecursively(args.working_dir)
tf.gfile.MakeDirs(args.working_dir)
tf.gfile.MakeDirs(discovered_concepts_dir)
tf.gfile.MakeDirs(results_dir)
tf.gfile.MakeDirs(cavs_dir)
tf.gfile.MakeDirs(activations_dir)
tf.gfile.MakeDirs(results_summaries_dir)
random_concept = 'random_discovery' # Random concept for statistical testing
sess = utils.create_session()
mymodel = ace_helpers.make_model(
sess, args.model_to_run, args.model_path, args.labels_path)
# Creating the ConceptDiscovery class instance
cd = ConceptDiscovery(
mymodel,
args.target_class,
random_concept,
args.bottlenecks.split(','),
sess,
args.source_dir,
activations_dir,
cavs_dir,
num_random_exp=args.num_random_exp,
channel_mean=True,
max_imgs=args.max_imgs,
min_imgs=args.min_imgs,