# Read config file (loads config file of trained model) params = Parameters(os.path.join(args.LOG_DIR, "config.yaml")) params.update_parameters(args.CONFIG_FILE) # Save parameters params.write_parameters() ############################################################################### #%% Load model print() # Init model model = torch.load( os.path.join(params.getp("MODEL_DIR"), "best_train_model_checkpoint_fold_00_sample_000.tar")) # Puts the model on device (GPU) model = model.cuda(device=params.getp("DEVICE_ID")) ############################################################################### #%% Read dataset repository # filenames = sorted( glob.glob(os.path.join(params.getp("DATASET_DIR"), "test", "*.ply"))) print() print( "###############################################################################"
args = parser.parse_args() ############################################################################## #%% Read config file # Read config file params = Parameters(args.CONFIG_FILE) # Save parameters params.write_parameters() ############################################################################### #%% Build model # Init model model = models.models_dict[params.getp("MODEL_NAME")]( nb_channels=params.getp("NB_CHANNELS"), nb_classes=params.getp("NB_CLASSES"), nb_scales=params.getp("NB_SCALES")) # Puts the model on device (GPU) model = model.cuda(device=params.getp("DEVICE_ID")) # Initialize weights of the model model.init(params.getp("INITIALIZATION")) # Defines Loss Function criterion = nn.CrossEntropyLoss() ############################################################################### #%% Read dataset repository
parser.print_help() args = parser.parse_args() ############################################################################### #%% Read config file # Read config file (loads config file of trained model) training_params = Parameters(os.path.join(args.LOG_DIR, "config.yaml")) ############################################################################### ABSCISSE_COORDINATE = 0 # epoch # ABSCISSE_COORDINATE = 1 # cpt_backward_pass # ABSCISSE_COORDINATE = 5 # time ############################################################################### nb_classes = training_params.getp("NB_CLASSES") LOG_DIR = training_params.getp("LOG_DIR") log_files = glob.glob(os.path.join(LOG_DIR, "*.txt")) # Training and Validation Loss and Accuracy print("\n 1st figure : Loss and Accuracy") fig1, (axes_loss, axes_acc) = plt.subplots(2, 1) axes_loss.set_title("Loss") axes_loss.set_ylabel('Loss') axes_loss.set_yscale('log') axes_loss.set_xlabel('epoch' if ABSCISSE_COORDINATE == 0 else ( 'number of samples' if ABSCISSE_COORDINATE == 1 else 'time (s)'))