Example #1
0
def plot_iou(checkpoint_dir, iou_list):
    x = range(0, len(iou_list))
    y = iou_list
    plt.switch_backend('agg')
    plt.plot(x, y, color='red', marker='o', label='IOU')
    plt.xticks(range(0, len(iou_list) + 3, (len(iou_list) + 10) // 10))
    plt.legend()
    plt.grid()
    plt.savefig(os.path.join(checkpoint_dir, 'iou_fig.pdf'))
    plt.close()
Example #2
0
def plot_loss(checkpoint_dir, loss_list, save_pred_every):
    x = range(0, len(loss_list) * save_pred_every, save_pred_every)
    y = loss_list
    plt.switch_backend('agg')
    plt.plot(x, y, color='blue', marker='o', label='Train loss')
    plt.xticks(range(0, len(loss_list) * save_pred_every + 3, (len(loss_list) * save_pred_every + 10) // 10))
    plt.legend()
    plt.grid()
    plt.savefig(os.path.join(checkpoint_dir, 'loss_fig.pdf'))
    plt.close()
Example #3
0
def plot_precisonAndjac(checkpoint_dir, pre_list, jac_list):
    x = range(0, len(pre_list))
    y = pre_list
    y2 = jac_list
    plt.switch_backend('agg')
    plt.plot(x, y, color='red', marker='o', label='precision')
    plt.plot(x, y2, color='blue', marker='o', label='jaccard')
    plt.xticks(range(0, len(pre_list) + 3, (len(pre_list) + 10) // 10))
    plt.legend()
    plt.grid()
    plt.savefig(os.path.join(checkpoint_dir, 'precisionAndjac_fig1.pdf'))
    plt.close()
Example #4
0
# coding=utf-8
import torch as t
from torch import nn
from torch.autograd import Variable
from torch.optim import Adam
from torchvision import transforms
from torchvision.utils import make_grid
from pylab import plt
plt.switch_backend('agg')

from lib.datareader.pytorch.cifar import Cifar10DataSet
from lib.utils.progressbar.ProgressBar import ProgressBar

class Config:
    lr = 0.0002
    nz = 100 # noise dimension
    image_size = 64
    image_size2 = 64
    nc = 3 # chanel of img
    ngf = 64 # generate channel
    ndf = 64 # discriminative channel
    beta1 = 0.5
    batch_size = 32
    max_epoch = 10 # =1 when debug
    workers = 2
    GPU_NUMS = 2 # use gpu or not

opt=Config()

transform=transforms.Compose([
    transforms.Resize(opt.image_size) ,