help='Specify shuffle for Adversarial Training.') parser.add_argument('--lang', default='en', choices=['en', 'ja'], type=str, help='Specify language of report.') args = parser.parse_args() print(args) # Read config.ini. config = configparser.ConfigParser() config.read(os.path.join(full_path, 'config.ini')) # Load dataset. ret_status, x_test_path, y_test_path, X_test, y_test = utility.load_dataset( args.test_data_name, args.test_label_name, args.use_x_test_num) if ret_status is False: utility.print_message( FAIL, 'Could not load dataset: {}'.format(args.op_type)) utility.write_log( 20, '[Out] Adversarial Threat Detector [{}].'.format(file_name)) sys.exit(0) # Load target model. ret_status, model_path, model = utility.load_model(args.model_name) if ret_status is False: utility.write_log( 20, '[Out] Adversarial Threat Detector [{}].'.format(file_name)) sys.exit(0) # Preparation.
args = parser.parse_args() print(args) # Read config.ini. config = configparser.ConfigParser() config.read(os.path.join(full_path, 'config.ini')) # Load target model. ret_status, model_path, model = utility.load_model(args.model_name) if ret_status is False: utility.write_log( 20, '[Out] Adversarial Threat Detector [{}].'.format(file_name)) sys.exit(0) # Load dataset. ret_status, dataset_path, label_path, X_test, y_test = utility.load_dataset( args.dataset_name, args.label_name, args.use_dataset_num) if ret_status is False: utility.write_log( 20, '[Out] Adversarial Threat Detector [{}].'.format(file_name)) sys.exit(0) # Report setting. report_util.make_report_dir() sampling_idx = utility.random_sampling( data_size=len(X_test), sample_num=report_util.adv_sample_num) benign_sample_list = report_util.make_image(X_test, 'benign', sampling_idx) # Data to report's template. report_util.template_target['model_path'] = model_path report_util.template_target['dataset_path'] = dataset_path report_util.template_target['label_path'] = label_path