print "Looking for Previous Model to load." ModelName = Name if ECAL and HCAL: ModelName += "_Merged" MyModel = ModelWrapper(Name=ModelName, LoadPrevious=True, OutputBase=OutputBase) # You can load a previous model using "-L" option with the model directory. if LoadModel and BuildModel: print "Loading Model From:", LoadModel if LoadModel[-1] == "/": LoadModel = LoadModel[:-1] MyModel = ModelWrapper(Name=os.path.basename(LoadModel), InDir=os.path.dirname(LoadModel), OutputBase=OutputBase) MyModel.Load(LoadModel) if BuildModel and not MyModel.Model: FailedLoad = True else: FailedLoad = False # Or Build the model from scratch if BuildModel and not MyModel.Model: import keras print "Building Model...", if ECAL: ECALModel = Convolutional3D(Name + "ECAL") ECALModel.Build() MyModel = ECALModel
# You can automatically load the latest previous training of this model. if TestDefaultParam("LoadPreviousModel") and not LoadModel: print "Looking for Previous Model to load." ReconstructionModel = ModelWrapper(Name=Name, LoadPrevious=True, OutputBase=OutputBase) # You can load a previous model using "-L" option with the model directory. if LoadModel: print "Loading Model From:", LoadModel if LoadModel[-1] == "/": LoadModel = LoadModel[:-1] ReconstructionModel = ModelWrapper(Name=os.path.basename(LoadModel), InDir=os.path.dirname(LoadModel), OutputBase=OutputBase) ReconstructionModel.Load(LoadModel) if not ReconstructionModel.Model: FailedLoad = True else: FailedLoad = False # Or Build the model from scratch if FailedLoad: import keras print "Building Model...", ReconstructionModel = Model2DViewsTo3D( Name, View1, View2,