diff --git a/eval_on_val.py b/eval_on_val.py index 6540350..12632fe 100644 --- a/eval_on_val.py +++ b/eval_on_val.py @@ -1,4 +1,4 @@ -# camera-ready if everything works (need to modify paths) +# camera-ready if everything works from datasets import DatasetVal # (this needs to be imported before torch, because cv2 needs to be imported before torch for some reason) from deeplabv3 import DeepLabV3 @@ -21,11 +21,11 @@ batch_size = 8 -network = DeepLabV3("eval_val", project_dir="/staging/frexgus/multitask").cuda() -network.load_state_dict(torch.load("/staging/frexgus/multitask/training_logs/model_13_2_2/checkpoints/model_13_2_2_epoch_573.pth")) +network = DeepLabV3("eval_val", project_dir="/root/deeplabv3").cuda() +network.load_state_dict(torch.load("/root/deeplabv3/pretrained_models/model_13_2_2_2_epoch_580.pth")) -val_dataset = DatasetVal(cityscapes_data_path="/datasets/cityscapes", - cityscapes_meta_path="/staging/frexgus/cityscapes/meta") +val_dataset = DatasetVal(cityscapes_data_path="/root/deeplabv3/data/cityscapes", + cityscapes_meta_path="/root/deeplabv3/data/cityscapes/meta") num_val_batches = int(len(val_dataset)/batch_size) print ("num_val_batches:", num_val_batches) @@ -34,7 +34,7 @@ batch_size=batch_size, shuffle=False, num_workers=4) -with open("/staging/frexgus/cityscapes/meta/class_weights.pkl", "rb") as file: # (needed for python3) +with open("/root/deeplabv3/data/cityscapes/meta/class_weights.pkl", "rb") as file: # (needed for python3) class_weights = np.array(pickle.load(file)) class_weights = torch.from_numpy(class_weights) class_weights = Variable(class_weights.type(torch.FloatTensor)).cuda() @@ -80,7 +80,7 @@ overlayed_img = 0.35*img + 0.65*pred_label_img_color overlayed_img = overlayed_img.astype(np.uint8) - cv2.imwrite("/staging/frexgus/multitask/training_logs/model_eval/" + img_id + "_overlayed.png", overlayed_img) + cv2.imwrite(network.model_dir + "/" + img_id + "_overlayed.png", overlayed_img) val_loss = np.mean(batch_losses) print ("val loss: %g" % val_loss) diff --git a/pretrained_models/model_13_2_2_2_epoch_580.pth b/pretrained_models/model_13_2_2_2_epoch_580.pth new file mode 100644 index 0000000..219273b Binary files /dev/null and b/pretrained_models/model_13_2_2_2_epoch_580.pth differ