Example #1
0
import os
import numpy as np
import torch
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import StepLR
import torch.optim as optim
import torch.nn as nn
from CT_dataset import *
from UNet3D import *
from losses_and_metrics import *
import utils
import pandas as pd

if __name__ == '__main__':

    torch.cuda.set_device(utils.get_avail_gpu()
                          )  # assign which gpu will be used (only linux works)
    use_visdom = True

    train_list = './train_list.csv'
    val_list = './val_list.csv'

    model_path = './models'
    model_name = 'ALV_unet3d_patch64x64x64_1500_3labels_30samples'  #remember to include the project title (e.g., ALV)
    checkpoint_name = 'latest_checkpoint.tar'

    num_classes = 3
    num_channels = 1
    num_epochs = 50
    num_workers = 6
    train_batch_size = 6
Example #2
0
import os
import numpy as np
import torch
import torch.nn as nn
from meshsegnet import *
import utils
from easy_mesh_vtk import *
import pandas as pd
from losses_and_metrics_for_mesh import *
from scipy.spatial import distance_matrix

if __name__ == '__main__':
    
    torch.cuda.set_device(utils.get_avail_gpu()) # assign which gpu will be used (only linux works)
      
    model_path = './models'
    model_name = 'Mesh_Segementation_MeshSegNet_15_classes_60samples_best.tar'
    
    mesh_path = ''  # need to define
    sample_filenames = ['Sample_0101_d.stl'] # need to define
    output_path = './outputs'
    if not os.path.exists(output_path):
        os.mkdir(output_path)
    
    num_classes = 15
    num_channels = 15
          
    # set model
    device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
    model = MeshSegNet(num_classes=num_classes, num_channels=num_channels).to(device, dtype=torch.float)
    
import utils
from easy_mesh_vtk.easy_mesh_vtk import *
import pandas as pd
from losses_and_metrics_for_mesh import *
from scipy.spatial import distance_matrix
import scipy.io as sio
import matlab.engine
import shutil
import time
#from sklearn.svm import SVC
from thundersvm import SVC
from sklearn.neighbors import KNeighborsClassifier

if __name__ == '__main__':
    
    gpu_id = utils.get_avail_gpu()
    torch.cuda.set_device(gpu_id) # assign which gpu will be used (only linux works)

    upsampling_method = 'SVM'
    #upsampling_method = 'KNN'
      
    model_path = './models'
    model_name = 'Mesh_Segementation_MeshSegNet_15_classes_60samples_best.tar'
    
    mesh_path = './inputs'
    sample_filenames = ['upper_T0.stl', 'upper_T1_aligned.stl']
    output_path = './outputs'
    if not os.path.exists(output_path):
        os.mkdir(output_path)
    
    num_classes = 15