File size: 1,089 Bytes
4a1f918
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import torch
import PIL.Image as Image
import matplotlib.pyplot as plt
import sys

sys.path.append("/home/ubuntu/Desktop/Domain_Adaptation_Project/repos/biastuning/")

from utils import *

results_folder_name = 'endovis18_10label_textaffine_decdertuning_4e-4_adamw_focal_alpha75e-2_gamma_2_256_bs64_rsz_manyaug_blanklables'

ious_all = {}
for object in os.listdir(results_folder_name):
    ious = []
    print("Starting object: ", object)
    preds_path = os.path.join(results_folder_name, object, 'rescaled_preds')
    gt_path = os.path.join(results_folder_name, object, 'rescaled_gt')
    for i,im in enumerate(os.listdir(gt_path)):
        if i<13:
            continue
        label = np.array(Image.open(os.path.join(gt_path,im)))[60:306,150:400]
        label = (label>127)+0
        pred = np.array(Image.open(os.path.join(preds_path,im)))[60:306, 150:400]
        pred = (pred>127) + 0
        plt.imshow(label)
        plt.show()
        plt.imshow(label)
        plt.show()
        print(label.shape)
        print(pred.shape)
        print(np.unique(pred))
        1/0