This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SimpleITK as sitk | |
# read image | |
inputImage = sitk.ReadImage('/path/to/input.nii.gz') | |
# get result in the form of a numpy array | |
npa_res = my_algorithm(sitk.GetArrayFromImage(inputImage)) # my_algorithm does something fancy | |
# Converting back to SimpleITK (assumes we didn't move the image in space as we copy the information from the original) | |
result_image = sitk.GetImageFromArray(npa_res) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Choose the segmentation model here | |
# options: unet, resunet, fcn | |
model: | |
{ | |
architecture: resunet, | |
final_layer: softmax | |
} | |
# Set base filters: number of filters present in the initial module of the U-Net convolution; for IncU-Net, keep this divisible by 4 | |
base_filters: 30 | |
# Set the list of labels the model should train on and predict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy as np | |
folds = [5,5] | |
exp_path = "./outputs/resunet_e1_new/" | |
avg_dice = [] | |
for holdout in os.listdir(os.path.join(exp_path)): | |
for fold in os.listdir(os.path.join(exp_path,holdout)): | |
if not ".pkl" in fold: | |
for item in os.listdir(os.path.join(exp_path,holdout,fold)): | |
if "stdout" in item: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2020-10-29 7:15:17.47: =============================== logger created ======================================= | |
2020-10-29 7:15:17.47: | |
2020-10-29 7:15:17.47: ======================== Starting new session ============================ | |
2020-10-29 7:15:17.47: Command line arguments given: | |
Namespace(device='cuda', model_cfg='./outputs/dm_e1/holdout_0/0/modelConfig.cfg', reset_trainer=False, saved_model=None, test_cfg=None, train_cfg='./outputs/dm_e1/holdout_0/0/trainConfig.cfg') | |
2020-10-29 7:15:18.08: Available devices to Tensorflow: | |
[name: "/device:CPU:0" | |
device_type: "CPU" | |
memory_limit: 268435456 | |
locality { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATA_DIR='./data/datasets' | |
MAX_DEPTH=15 | |
MAX_NODES=30 | |
SEARCH_METHOD=bfs | |
MODEL=LSTM | |
NUM_EPOCHS_MENTION_ONLY=1 | |
NUM_EPOCHS_WITH_COHERENCE=30 | |
BATCH_SIZE=32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from turtle import forward | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch | |
from typing import Dict, Iterable, Callable | |
import torchvision | |
from models.pretrained_implementations import resnet18_pret | |
from models.conv_iResNet import conv_iResNet | |
# Acknowledgement to | |
# https://github.com/kuangliu/pytorch-cifar, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import numpy as np | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import os | |
import kornia as K | |
import tqdm | |
from torch.utils.data import Dataset | |
from torchvision import datasets, transforms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import time | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torchvision import datasets, transforms | |
import torchvision | |
from torch.utils.data import Dataset | |
from scipy.ndimage.interpolation import rotate as scipyrotate | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from utils.evaluator_utils import EvaluatorUtils | |
ds_train = datasets.CIFAR10('data', train=True, download=True, transform=transform) | |
ds_test = datasets.CIFAR10('data', train=False, download=True, transform=transform) | |
images_all = [torch.unsqueeze(ds_train[i][0], dim=0) for i in range(len(ds_train))] | |
labels_all = [ds_train[i][1] for i in range(len(ds_train))] | |
class_pos_list = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import time | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
from torchvision import datasets, transforms | |
import torchvision | |
from torch.utils.data import Dataset | |
from scipy.ndimage.interpolation import rotate as scipyrotate | |
import sys |
OlderNewer