logger.info("Saved model history: {}".format(model_history_name)) except Exception as exc: logger.exception(exc) # Reset model and history model = None history = None logger.info("FINISHED running simulations") ################################################# # Main functions for each hardware configuration ################################################# def main(): """ Main function to run training and prediction. """ mod = functional_sony() run_simulation(mod) ####################################################### # Running train_model script, Jupyter Notebook config ####################################################### enable_cloud_log('INFO') main()
at each convolutional layer, for example. """ import logging from urllib.parse import urljoin from tensorflow.train import AdamOptimizer from tensorflow.keras.callbacks import ModelCheckpoint from tensorflow.keras.datasets import cifar10 from tensorflow.keras.optimizers import Adam from model01 import simple_sony, full_sony from model_utils import enable_cloud_log, plot_imgpair, plot_loss from custom_loss import mean_absolute_error logger = logging.getLogger(__name__) enable_cloud_log(level='DEBUG') # Create checkpoint callback checkpoint_path = 'checkpoints/cp.ckpt' cp_callback = ModelCheckpoint(checkpoint_path, save_weights_only=True, verbose=1) # Dataset of 50,000 32x32 color training images, # labeled over 10 categories, and 10,000 test images. (X_train, y_train), (X_test, y_test) = cifar10.load_data() m = 64 #Y_train = X_train
] for imgtup in imgman: # Define model model = model02() imgname, imgfunc = imgtup logger.info("Processing: {}".format(imgtup[0])) model = fit_model(X_train, Y_test, model, checkpoint_dir, imgtup) Y_pred = model_predict(model, X_test, imgtup) review_image_output(X_test, Y_pred, Y_test, imgtup, every=10) model = None logger.info("FINISHED running simulations") if __name__ == "__main__": enable_cloud_log('DEBUG') fcov = "simulation_cov.pkl" fmean = "simulation_mean.pkl" COVM = read_pickle(fcov) MEANM = read_pickle(fmean) run_simulation(fcov, fmean)