text: import os
  # os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"   # see issue #152
  # os.environ["CUDA_VISIBLE_DEVICES"] = ""
  import argparse
  import configparser
  from shutil import copyfile
  from importlib import import_module
  
  import numpy as np
  import pandas as pd
  from tqdm import tqdm
  
  from PIL import ImageFile #jedan je buggy malo
  ImageFile.LOAD_TRUNCATED_IMAGES = True 
  from skimage.io import imread
  
  import warnings
  
  #### Script creates model file from weights which can be loaded using keras load_model function so the graph code doesn't have to be executed
  
  
  parser = argparse.ArgumentParser()
  parser.add_argument("ModelName", help= "Model class name")
  parser.add_argument("PreprocessorName", help = "Preprocessor class name")
  parser.add_argument("Weights", help = "Path to model weights")
  parser.add_argument("FileOutputName", help = "File output name")
  args = parser.parse_args()
  
  config = configparser.ConfigParser()
  config.optionxform = str
  config.read("./config.cfg")
  
  
  model_parameters = dict(config.items(args.ModelName))
  preprocessor_parameters = dict(config.items(args.PreprocessorName))
  data_parameters = dict(config.items('Data'))
  
  #load preprocessor
  module_name = preprocessor_parameters['PreprocessorModule']
  input_path = data_parameters['Inputs']
  
  module = import_module("preprocessors.%s" % (module_name))
  preprocessor_class = getattr(module, args.PreprocessorName)
  preprocessor = preprocessor_class(input_path, preprocessor_parameters) #needs to be changed for processor params or something
  
  #load network model
  module_name = model_parameters['ModelModule']
  checkpoint_dir = data_parameters['CheckpointDirectory']
  result_path = data_parameters['Outputs']
  
  module = import_module("models.%s" % (module_name))
  ml_class= getattr(module, args.ModelName)
  my_model = ml_class(result_path, checkpoint_dir, model_parameters, preprocessor, train=False)
  my_model.init_network()
  
  
  my_model.model.load_weights(args.Weights, by_name = True, skip_mismatch = True)
  my_model.model.save('%s.h5' % args.FileOutputName)