keyword stringclasses 7
values | repo_name stringlengths 8 98 | file_path stringlengths 4 244 | file_extension stringclasses 29
values | file_size int64 0 84.1M | line_count int64 0 1.6M | content stringlengths 1 84.1M ⌀ | language stringclasses 14
values |
|---|---|---|---|---|---|---|---|
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/pq_top.m | .m | 769 | 27 | % PQ_TOP queries for the topmost element of the priority queue (not removing it)
%
% SYNTAX
% [idx, cost] = pq_top(pq)
%
% INPUT PARAMETERS
% pq: a pointer to the priority queue
%
% OUTPUT PARAMETERS
% idx: the index of the topmost element
% cost: the cost of the topmost element
%
% DESCRIPTION
% Queries the top... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/pq_create.cpp | .cpp | 1,760 | 55 | //==============================================================================
// Name : myheaps_demo.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : creates a (top-down) priority queue
//
// May 22, 2009: Created
//==================... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/pq_create.m | .m | 1,270 | 40 | % PQ_CREATE construct a priority queue object
%
% SYNTAX
% pq = pq_create(p)
%
% INPUT PARAMETERS
% N: the maximum number of elements in the priority queue
%
% OUTPUT PARAMETERS
% pq: a (memory) pointer to the created data structure
%
% DESCRIPTION
% Given a positive integer N this function allocates the memory for... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/pq_top.cpp | .cpp | 2,031 | 58 | //==============================================================================
// Name : pq_top.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : Returns the topmost element in the priority queue (not popping it)
//
// May 22, 2009: Cre... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/pq_delete.cpp | .cpp | 1,795 | 54 | //==============================================================================
// Name : pq_delete.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : Frees the memory allocated by the priority queue
//
// May 22, 2009: Created
//========... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/MyHeap.h | .h | 13,656 | 486 | /**
* @file MyHeaps.h
* @author Andrea Tagliasacchi
* @date 26 March 2008
* @copyright (c) Andrea Tagliasacchi - All rights reserved
*/
//--- CHANGELOG
//
// Sunday Feb 20th 2011:
// corrected bug at .pop() which would not clear index
// in the back-indexing array. Many thanks to Tim Holy
// to point it ... | Unknown |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/pq_size.m | .m | 858 | 28 | % PQ_SIZE returns the number of elements in the priority queue
%
% SYNTAX
% sz = pq_size(pq)
%
% INPUT PARAMETERS
% pq: a pointer to the priority queue
%
% OUTPUT PARAMETERS
% sz: the number of elements in the priority queue
%
% DESCRIPTION
% Queries the priority queue for the number of elements that it contains.... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/pq_delete.m | .m | 570 | 22 | % PQ_DELETE construct a priority queue object
%
% SYNTAX
% pq_delete(pq)
%
% INPUT PARAMETERS
% pq: a pointer to the priority queue
%
% DESCRIPTION
% De-allocates the memory for the priority queue.
%
% See also:
% PQ_DEMO, PQ_CREATE, PQ_PUSH, PQ_POP, PQ_SIZE, PQ_TOP, PQ_DELETE
%
% References:
% Gormen, T.H. and Lei... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0_old/pq_demo.m | .m | 1,014 | 39 | % PQ_DEMO compiles library and illustrate Priority Queue's functionalities
%
% Copyright (c) 2008 Andrea Tagliasacchi
% All Rights Reserved
% email: andrea.tagliasacchi@gmail.com
% $Revision: 1.0$ Created on: May 22, 2009
clc, clear, close all;
mex pq_create.cpp;
mex pq_push.cpp;
mex pq_pop.cpp;
mex pq_size.cpp;
... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_pop.m | .m | 725 | 26 | % PQ_POP removes the topmost element of the priority queue
%
% SYNTAX
% [idx, cost] = pq_pop(pq)
%
% INPUT PARAMETERS
% pq: a pointer to the priority queue
%
% OUTPUT PARAMETERS
% idx: the index of the popped element
% cost: the cost of the popped element
%
% DESCRIPTION
% Removes the topmost element from a prio... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_push.m | .m | 902 | 29 | % PQ_PUSH inserts a new element/update a cost in the priority queue
%
% SYNTAX
% pq_push(pq, idx, cost)
%
% INPUT PARAMETERS
% pq: a pointer to the priority queue
%
% OUTPUT PARAMETERS
% idx: the index of the element
% cost: the cost of the newly inserted element or the
% cost to which the element shoul... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_pop.cpp | .cpp | 2,061 | 62 | //==============================================================================
// Name : pq_pop.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : pops an element from the PQ and returns its index and cost
//
// May 22, 2009: Created
//=... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_size.cpp | .cpp | 1,873 | 53 | //==============================================================================
// Name : pq_size.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : Returns the size of the priority queue
//
// May 22, 2009: Created
//====================... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_demo.cpp | .cpp | 7,872 | 330 | #include "MyHeap.h"
#include <stdlib.h>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
/// TEST FOR MAXHEAP
int test1(){
MaxHeap<double> pq(7); // heap of ints compared by doubles
pq.push( 1,1 );
pq.push( 6,0 );
pq.push( 2,4 );
pq.push( 3,3 );
pq.push( 4,2 );
pq.push( 5,5 );
//... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/MyHeap_old.h | .h | 13,341 | 474 | /**
* @file MyHeaps.h
* @author Andrea Tagliasacchi
* @data 26 March 2008
* @copyright (c) Andrea Tagliasacchi - All rights reserved
*/
#ifndef MYHEAPS_H_
#define MYHEAPS_H_
#include <vector>
#include <exception> // general exception
#include <stdexcept> // out_of_range
#include <iostream>
#include <cassert>
#in... | Unknown |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_push.cpp | .cpp | 2,996 | 91 | //==============================================================================
// Name : pq_push.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : inserts a new element in the priority queue
//
// May 22, 2009: Created
//===============... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_top.m | .m | 769 | 27 | % PQ_TOP queries for the topmost element of the priority queue (not removing it)
%
% SYNTAX
% [idx, cost] = pq_top(pq)
%
% INPUT PARAMETERS
% pq: a pointer to the priority queue
%
% OUTPUT PARAMETERS
% idx: the index of the topmost element
% cost: the cost of the topmost element
%
% DESCRIPTION
% Queries the top... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_create.cpp | .cpp | 1,774 | 55 | //==============================================================================
// Name : myheaps_demo.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : creates a (top-down) priority queue
//
// May 22, 2009: Created
//==================... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_create.m | .m | 1,270 | 40 | % PQ_CREATE construct a priority queue object
%
% SYNTAX
% pq = pq_create(p)
%
% INPUT PARAMETERS
% N: the maximum number of elements in the priority queue
%
% OUTPUT PARAMETERS
% pq: a (memory) pointer to the created data structure
%
% DESCRIPTION
% Given a positive integer N this function allocates the memory for... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_top.cpp | .cpp | 2,059 | 58 | //==============================================================================
// Name : pq_top.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : Returns the topmost element in the priority queue (not popping it)
//
// May 22, 2009: Cre... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_delete.cpp | .cpp | 1,823 | 54 | //==============================================================================
// Name : pq_delete.cpp
// Author : Andrea Tagliasacchi
// Version : 1.0
// Copyright : 2009 (c) Andrea Tagliasacchi
// Description : Frees the memory allocated by the priority queue
//
// May 22, 2009: Created
//========... | C++ |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/MyHeap.h | .h | 13,656 | 486 | /**
* @file MyHeaps.h
* @author Andrea Tagliasacchi
* @date 26 March 2008
* @copyright (c) Andrea Tagliasacchi - All rights reserved
*/
//--- CHANGELOG
//
// Sunday Feb 20th 2011:
// corrected bug at .pop() which would not clear index
// in the back-indexing array. Many thanks to Tim Holy
// to point it ... | Unknown |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_size.m | .m | 858 | 28 | % PQ_SIZE returns the number of elements in the priority queue
%
% SYNTAX
% sz = pq_size(pq)
%
% INPUT PARAMETERS
% pq: a pointer to the priority queue
%
% OUTPUT PARAMETERS
% sz: the number of elements in the priority queue
%
% DESCRIPTION
% Queries the priority queue for the number of elements that it contains.... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_delete.m | .m | 570 | 22 | % PQ_DELETE construct a priority queue object
%
% SYNTAX
% pq_delete(pq)
%
% INPUT PARAMETERS
% pq: a pointer to the priority queue
%
% DESCRIPTION
% De-allocates the memory for the priority queue.
%
% See also:
% PQ_DEMO, PQ_CREATE, PQ_PUSH, PQ_POP, PQ_SIZE, PQ_TOP, PQ_DELETE
%
% References:
% Gormen, T.H. and Lei... | MATLAB |
3D | stillbreeze/3D-reconstruction-Using-SfM-and-Stereo-Matching | code/SFMedu/denseMatch/priority_queue_1.0/pq_demo.m | .m | 1,014 | 39 | % PQ_DEMO compiles library and illustrate Priority Queue's functionalities
%
% Copyright (c) 2008 Andrea Tagliasacchi
% All Rights Reserved
% email: andrea.tagliasacchi@gmail.com
% $Revision: 1.0$ Created on: May 22, 2009
clc, clear, close all;
mex pq_create.cpp;
mex pq_push.cpp;
mex pq_pop.cpp;
mex pq_size.cpp;
... | MATLAB |
3D | oopil/3D_medical_image_FSS | FSS1000/train.py | .py | 7,425 | 180 | """Training Script"""
import os
import shutil
import numpy as np
import pdb
import random
import torch
import torch.nn as nn
import torch.optim
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import MultiStepLR
import torch.backends.cudnn as cudnn
from torchvision.transforms import Compose
import... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/test.py | .py | 9,591 | 241 | """Evaluation Script"""
import os
import shutil
import pdb
import tqdm
import numpy as np
import torch
import torch.optim
import torch.nn as nn
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
from torchvision.transforms import Compose
from torchvision.utils import make_grid
from math import... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/test_visual.py | .py | 5,553 | 156 | """Evaluation Script"""
import os
import shutil
import pdb
import tqdm
import numpy as np
import torch
import torch.optim
import torch.nn as nn
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
from torchvision.transforms import Compose
from torchvision.utils import make_grid
from math import... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/config.py | .py | 3,930 | 147 | """Experiment Configuration"""
import os
import re
import glob
import itertools
import sacred
from sacred import Experiment
from sacred.observers import FileStorageObserver
from sacred.utils import apply_backspaces_and_linefeeds
sacred.SETTINGS['CONFIG']['READ_ONLY_CONFIG'] = False
sacred.SETTINGS.CAPTURE_MODE = 'no'... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/util/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/util/utils.py | .py | 2,004 | 74 | """Util functions"""
import random
import torch
import numpy as np
import os
from datetime import datetime
def try_mkdir(path):
try:
os.mkdir(path)
print(f"mkdir : {path}")
except:
print(f"failed to make a directory : {path}")
def date():
now = datetime.now()
string = now.year + now.month + now.day
... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/models/decoder.py | .py | 6,184 | 149 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import numpy as np
# from torchsummary import summary
if __name__ == '__main__':
from nnutils import conv_unit
else:
from .nnutils import conv_unit
class Decoder(nn.Module):
def __init__(self, input_channels=512, input_r... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/models/encoder.py | .py | 2,230 | 66 | import pdb
import torch
import torch.nn as nn
import torchvision
from .vgg import Encoder_vgg
from .attention import PAM_Module, CAM_Module
# from torchsummary import summary
if __name__ == '__main__':
from nnutils import conv_unit
else:
from .nnutils import conv_unit
class SupportEncoder(nn.Module):
def _... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/models/nnutils.py | .py | 1,670 | 51 | import torch
import torch.nn as nn
def conv_unit(in_ch, out_ch, kernel_size, stride = 1, padding = 0, activation = 'relu', batch_norm = True):
seq_list = []
seq_list.append(nn.Conv2d(in_channels = in_ch, out_channels = out_ch, kernel_size = kernel_size, stride = stride, padding = padding))
if batch_norm:
... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/models/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/models/vgg.py | .py | 4,211 | 116 | """
Encoder for few shot segmentation (VGG16)
"""
import torch
import torch.nn as nn
import pdb
class Encoder_vgg(nn.Module):
"""
Encoder for few shot segmentation
Args:
in_channels:
number of input channels
pretrained_path:
path of the model for initialization
... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/models/attention.py | .py | 2,725 | 71 | import numpy as np
import torch
import math
import pdb
from torch.nn import Module, Sequential, Conv2d, ReLU,AdaptiveMaxPool2d, AdaptiveAvgPool2d, \
NLLLoss, BCELoss, CrossEntropyLoss, AvgPool2d, MaxPool2d, Parameter, Linear, Sigmoid, Softmax, Dropout, Embedding
from torch.nn import functional as F
from torch.auto... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/test/decathlon_5shot.sh | .sh | 2,110 | 31 | # this code require gpu_id when running
# 1 2 3 4 5 6 7 8 9 10 11 12 13
mkdir runs/log
mkdir runs/log/decathlon_5shot
gpu=$1
j=$2
j=7
organ=1
for support in 0 5 10 15 20
do
#echo "python train.py with mode=train gpu_id=${gpu} target=${organ} board=ID${j}_${organ} record=False n_work=3 external_train=decathlon n_shot=... | Shell |
3D | oopil/3D_medical_image_FSS | FSS1000/test/summarize_test_results.py | .py | 1,508 | 54 | import re
import glob
import numpy as np
def summarize(files):
if len(files) < 5:
print("There is no results for this set.")
return 0,0
dices = []
for file in files[:5]:
fd = open(file)
lines = fd.readlines()
# print(len(lines),file)
result_line = lines[-2]
... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/test/bcv_5shot_save_sample.sh | .sh | 754 | 26 | # test code for external dataset ctorg with different support data
mkdir runs/log
mkdir runs/log/bcv_dice_ce
declare -a gpu_list
gpu_list=(0 1 2 7)
gpu=$1
j=$2
idx=0
# BCV configuration
# 1 shot - 21, 3 shot - 5, 5 shot - 17
j=7
support=0
for organ in 1 3 6 14
do
echo "python test.py with target=${organ} snaps... | Shell |
3D | oopil/3D_medical_image_FSS | FSS1000/test/bcv_bladder.sh | .sh | 1,695 | 32 | # this code require gpu_id when running
# 1 2 3 4 5 6 7 8 9 10 11 12 13
mkdir runs/log
mkdir runs/log/bcv_bladder
gpu=$1
j=$2
organ=14
j=14
for support in 0 3 5 7 10
do
echo "python test.py with gpu_id=${gpu} target=${organ} board=ID${j}_${organ}_lowest record=False n_shot=1 s_idx=${support} snapshot=runs/PANet... | Shell |
3D | oopil/3D_medical_image_FSS | FSS1000/test/ctorg_5shot.sh | .sh | 1,580 | 26 | # this code require gpu_id when running
# 1 2 3 4 5 6 7 8 9 10 11 12 13
mkdir runs/log
mkdir runs/log/ctorg_5shot
gpu=$1
j=$2
j=8
for organ in 3 6 14
do
for support in 0 5 10 15 20
do
#echo "python train.py with mode=train gpu_id=${gpu} target=${organ} board=ID${j}_${organ} record=False n_work=3 exte... | Shell |
3D | oopil/3D_medical_image_FSS | FSS1000/dataloaders_medical/decathlon.py | .py | 10,510 | 285 | import os
import re
import sys
import json
import math
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def prostate_img_process(img_... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/dataloaders_medical/common.py | .py | 6,690 | 210 | """
Dataset classes for common uses
"""
import random
import SimpleITK as sitk
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
import torch
import torchvision.transforms.functional as tr_F
from skimage.exposure import equalize_hist
import pdb
def crop_resize(slice):
x_size, y_size = n... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/dataloaders_medical/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/dataloaders_medical/dataset_CT_ORG.py | .py | 10,422 | 278 | import os
import re
import sys
import json
import math
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def totensor(arr):
tensor... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/dataloaders_medical/dataset_decathlon.py | .py | 14,795 | 458 | import os
import re
import sys
import json
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def totensor(arr):
tensor = torch.fro... | Python |
3D | oopil/3D_medical_image_FSS | FSS1000/dataloaders_medical/prostate.py | .py | 8,728 | 224 | import sys
import glob
import json
import re
from glob import glob
from util.utils import *
from dataloaders_medical.decathlon import *
from dataloaders_medical.dataset_decathlon import *
from dataloaders_medical.dataset_CT_ORG import *
import numpy as np
class MetaSliceData_train():
def __init__(self, datasets, i... | Python |
3D | oopil/3D_medical_image_FSS | PANet/train.py | .py | 6,426 | 163 | """Training Script"""
import os
import shutil
import numpy as np
import pdb
import random
import torch
import torch.nn as nn
import torch.optim
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import MultiStepLR
import torch.backends.cudnn as cudnn
from torchvision.transforms import Compose
import... | Python |
3D | oopil/3D_medical_image_FSS | PANet/test.py | .py | 8,803 | 224 | """Evaluation Script"""
import os
import shutil
import pdb
import tqdm
import numpy as np
import torch
import torch.optim
import torch.nn as nn
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
from torchvision.utils import make_grid
from models.fewshot import FewShotSeg
from util.utils impo... | Python |
3D | oopil/3D_medical_image_FSS | PANet/config.py | .py | 4,180 | 153 | """Experiment Configuration"""
import os
import re
import glob
import itertools
import sacred
from sacred import Experiment
from sacred.observers import FileStorageObserver
from sacred.utils import apply_backspaces_and_linefeeds
sacred.SETTINGS['CONFIG']['READ_ONLY_CONFIG'] = False
sacred.SETTINGS.CAPTURE_MODE = 'no'... | Python |
3D | oopil/3D_medical_image_FSS | PANet/util/sbd_instance_process.py | .py | 1,242 | 39 | """
This snippet processes SBD instance segmentation data
and transform it from .mat to .png. Then transformed
images will be saved in VOC data folder. The name of
the new folder is "SegmentationObjectAug"
"""
import os
from scipy.io import loadmat
from PIL import Image
# set path
voc_dir = '../Pascal/VOCdevkit/VOC2... | Python |
3D | oopil/3D_medical_image_FSS | PANet/util/metric.py | .py | 6,195 | 152 | """
Metrics for computing evalutation results
"""
import numpy as np
class Metric(object):
"""
Compute evaluation result
Args:
max_label:
max label index in the data (0 denoting background)
n_runs:
number of test runs
"""
def __init__(self, max_label=20, n_... | Python |
3D | oopil/3D_medical_image_FSS | PANet/util/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | PANet/util/scribbles.py | .py | 12,787 | 344 | from __future__ import absolute_import, division
import networkx as nx
import numpy as np
from scipy.ndimage import binary_dilation, binary_erosion
from scipy.special import comb
from skimage.filters import rank
from skimage.morphology import dilation, disk, erosion, medial_axis
from sklearn.neighbors import radius_ne... | Python |
3D | oopil/3D_medical_image_FSS | PANet/util/voc_classwise_filenames.py | .py | 2,540 | 72 | """
This snippet processes VOC segmentation data
and generates filename list according to the
class labels each image contains.
This snippet will create folders under
"ImageSets/Segmentaion/" with the same
names as the splits. Each folder has 20 txt files
each contains the filenames whose associated image
contains thi... | Python |
3D | oopil/3D_medical_image_FSS | PANet/util/utils.py | .py | 1,995 | 74 | """Util functions"""
import random
from datetime import datetime
import torch
import numpy as np
def try_mkdir(path):
try:
os.mkdir(path)
print(f"mkdir : {path}")
except:
print(f"failed to make a directory : {path}")
def date():
now = datetime.now()
string = now.year + now.month + now.day
string ... | Python |
3D | oopil/3D_medical_image_FSS | PANet/models/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | PANet/models/fewshot.py | .py | 8,036 | 194 | """
Fewshot Semantic Segmentation
"""
import pdb
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
from .vgg import Encoder
class FewShotSeg(nn.Module):
"""
Fewshot Segmentation model
Args:
in_channels:
number of input channels
... | Python |
3D | oopil/3D_medical_image_FSS | PANet/models/vgg.py | .py | 2,350 | 75 | """
Encoder for few shot segmentation (VGG16)
"""
import torch
import torch.nn as nn
class Encoder(nn.Module):
"""
Encoder for few shot segmentation
Args:
in_channels:
number of input channels
pretrained_path:
path of the model for initialization
"""
def __... | Python |
3D | oopil/3D_medical_image_FSS | PANet/test/summarize_test_results.py | .py | 1,434 | 52 | import re
import glob
import numpy as np
def summarize(files):
if len(files) < 5:
print("There is no results for this set.")
return 0,0
dices = []
for file in files[:5]:
fd = open(file)
lines = fd.readlines()
# print(len(lines),file)
result_line = lines[-2]
... | Python |
3D | oopil/3D_medical_image_FSS | PANet/dataloaders_medical/decathlon.py | .py | 10,510 | 285 | import os
import re
import sys
import json
import math
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def prostate_img_process(img_... | Python |
3D | oopil/3D_medical_image_FSS | PANet/dataloaders_medical/common.py | .py | 6,690 | 210 | """
Dataset classes for common uses
"""
import random
import SimpleITK as sitk
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
import torch
import torchvision.transforms.functional as tr_F
from skimage.exposure import equalize_hist
import pdb
def crop_resize(slice):
x_size, y_size = n... | Python |
3D | oopil/3D_medical_image_FSS | PANet/dataloaders_medical/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | PANet/dataloaders_medical/dataset_CT_ORG.py | .py | 10,420 | 278 | import os
import re
import sys
import json
import math
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def totensor(arr):
tensor... | Python |
3D | oopil/3D_medical_image_FSS | PANet/dataloaders_medical/dataset_decathlon.py | .py | 14,795 | 458 | import os
import re
import sys
import json
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def totensor(arr):
tensor = torch.fro... | Python |
3D | oopil/3D_medical_image_FSS | PANet/dataloaders_medical/prostate.py | .py | 8,795 | 226 | import sys
import glob
import json
import re
from glob import glob
from util.utils import *
from dataloaders_medical.decathlon import *
from dataloaders_medical.dataset_decathlon import *
from dataloaders_medical.dataset_CT_ORG import *
import numpy as np
class MetaSliceData_train():
def __init__(self, datasets, i... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/train.py | .py | 6,662 | 175 | """Training Script"""
import os
import shutil
import numpy as np
import pdb
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import MultiStepLR
import torch.backends.cudnn as cudnn
from torchvision... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/model.py | .py | 3,724 | 78 | import pdb
import numpy as np
import torch
import torch.nn as nn
from models.encoder import SupportEncoder, QueryEncoder
from models.convgru import ConvBGRU
from models.decoder import Decoder
class MedicalFSS(nn.Module):
def __init__(self, config, device):
super(MedicalFSS, self).__init__()
self.co... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/test.py | .py | 11,927 | 301 | """Evaluation Script"""
import os
import shutil
import pdb
import tqdm
import numpy as np
import torch
import torch.optim
import torch.nn as nn
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
from torchvision.transforms import Compose
from torchvision.utils import make_grid
from math impor... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/config.py | .py | 3,802 | 145 | """Experiment Configuration"""
import os
import re
import glob
import itertools
import sacred
from sacred import Experiment
from sacred.observers import FileStorageObserver
from sacred.utils import apply_backspaces_and_linefeeds
sacred.SETTINGS['CONFIG']['READ_ONLY_CONFIG'] = False
sacred.SETTINGS.CAPTURE_MODE = 'no'... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/util/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/util/utils.py | .py | 2,004 | 74 | """Util functions"""
import random
import torch
import numpy as np
import os
from datetime import datetime
def try_mkdir(path):
try:
os.mkdir(path)
print(f"mkdir : {path}")
except:
print(f"failed to make a directory : {path}")
def date():
now = datetime.now()
string = now.year + now.month + now.day
... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/models/decoder.py | .py | 4,109 | 101 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import numpy as np
# from torchsummary import summary
if __name__ == '__main__':
from nnutils import conv_unit
else:
from .nnutils import conv_unit
class Decoder(nn.Module):
def __init__(self, input_channels=512, input_r... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/models/encoder.py | .py | 1,483 | 43 | import pdb
import torch
import torch.nn as nn
import torchvision
from .vgg import Encoder_vgg
# from torchsummary import summary
if __name__ == '__main__':
from nnutils import conv_unit
else:
from .nnutils import conv_unit
class SupportEncoder(nn.Module):
def __init__(self, pretrained_path, device):
... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/models/nnutils.py | .py | 1,670 | 51 | import torch
import torch.nn as nn
def conv_unit(in_ch, out_ch, kernel_size, stride = 1, padding = 0, activation = 'relu', batch_norm = True):
seq_list = []
seq_list.append(nn.Conv2d(in_channels = in_ch, out_channels = out_ch, kernel_size = kernel_size, stride = stride, padding = padding))
if batch_norm:
... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/models/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/models/vgg.py | .py | 4,435 | 119 | """
Encoder for few shot segmentation (VGG16)
"""
import torch
import torch.nn as nn
import pdb
class Encoder_vgg(nn.Module):
"""
Encoder for few shot segmentation
Args:
in_channels:
number of input channels
pretrained_path:
path of the model for initialization
... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/models/convgru.py | .py | 12,588 | 275 | import pdb
import torch
import torch.nn as nn
# from torchsummary import summary
if __name__ == '__main__':
from nnutils import conv_unit
else:
from .nnutils import conv_unit
class ConvGRUCell(nn.Module):
"""
Basic CGRU cell.
"""
def __init__(self, in_channels, hidden_channels, kernel_size, bi... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/models/convlstm.py | .py | 5,696 | 97 | import pdb
import torch
import torch.nn as nn
import torchvision
import numpy as np
# from torchsummary import summary
if __name__ == '__main__':
from nnutils import conv_unit
else:
from .nnutils import conv_unit
class SupportConvLSTMCell(nn.Module):
def __init__(self, channels = 512, height = 8, width = 8... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/test/summarize_test_results.py | .py | 13,672 | 403 | import re
import glob
import numpy as np
def access_dice_score(path):
fd = open(path)
lines = fd.readlines()
# print(len(lines),file)
result_line = lines[-2]
find = re.search("0.*", result_line)
line_parts = re.split(" ", result_line)
dice = line_parts[-2]
return dice
def summarize(fil... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/dataloaders_medical/common.py | .py | 6,690 | 210 | """
Dataset classes for common uses
"""
import random
import SimpleITK as sitk
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
import torch
import torchvision.transforms.functional as tr_F
from skimage.exposure import equalize_hist
import pdb
def crop_resize(slice):
x_size, y_size = n... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/dataloaders_medical/dataset.py | .py | 11,971 | 321 | import os
import re
import sys
import json
import math
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def prostate_img_process(img_... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/dataloaders_medical/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/dataloaders_medical/dataset_CT_ORG.py | .py | 11,500 | 297 | import os
import re
import sys
import json
import math
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def totensor(arr):
tensor... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/dataloaders_medical/dataset_decathlon.py | .py | 16,033 | 483 | import os
import re
import sys
import json
import random
import numpy as np
sys.path.append("/home/soopil/Desktop/github/python_utils")
# sys.path.append("../dataloaders_medical")
from dataloaders_medical.common import *
# from common import *
import cv2
from cv2 import resize
def totensor(arr):
tensor = torch.fro... | Python |
3D | oopil/3D_medical_image_FSS | BiGRU_fewshot/dataloaders_medical/prostate.py | .py | 9,422 | 245 | import sys
import glob
import json
import re
from glob import glob
from util.utils import *
from dataloaders_medical.dataset import *
from dataloaders_medical.dataset_decathlon import *
from dataloaders_medical.dataset_CT_ORG import *
import numpy as np
class MetaSliceData_train():
def __init__(self, datasets, ite... | Python |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/train.py | .py | 9,194 | 235 | """Training Script"""
import os
import shutil
import numpy as np
import pdb
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
from torch.utils.data import DataLoader
from torch.optim.lr_scheduler import MultiStepLR
import torch.backends.cudnn as cudnn
from torchvision... | Python |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/train_all.sh | .sh | 1,000 | 17 | # this code require gpu_id when running
# 1 2 3 4 5 6 7 8 9 10 11 12 13
gpu=$1
j=$2
for organ in 1 3 6 14
do
echo "python train.py with mode=train gpu_id=${gpu} target=${organ} board=ID${j}_${organ} record=False n_work=3 is_lowerbound=True"
python train.py with mode=train gpu_id=${gpu} target=${organ} board=ID... | Shell |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/train_all_ctorg.sh | .sh | 1,126 | 17 | # this code require gpu_id when running
# 1 2 3 4 5 6 7 8 9 10 11 12 13
gpu=$1
j=$2
for organ in 3 6 14
do
echo "python train.py with mode=train gpu_id=${gpu} target=${organ} board=ID${j}_${organ} record=False n_work=3 external_train=CT_ORG is_lowerbound=True"
python train.py with mode=train gpu_id=${gpu} targ... | Shell |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/train_all_decath.sh | .sh | 1,142 | 17 | # this code require gpu_id when running
# 1 2 3 4 5 6 7 8 9 10 11 12 13
gpu=$1
j=$2
for organ in 1 6
do
echo "python train.py with mode=train gpu_id=${gpu} target=${organ} board=ID${j}_${organ} record=False n_work=3 external_train=decathlon is_lowerbound=True "
python train.py with mode=train gpu_id=${gpu} tar... | Shell |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/model.py | .py | 1,070 | 28 | import pdb
import numpy as np
import torch
import torch.nn as nn
from models.encoder import Encoder
from models.decoder import Decoder
class MedicalFSS(nn.Module):
def __init__(self, config, device):
super(MedicalFSS, self).__init__()
self.config=config
resize_dim = self.config['input_size'... | Python |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/test.py | .py | 9,388 | 246 | """Evaluation Script"""
import os
import shutil
import pdb
import tqdm
import numpy as np
import torch
import torch.optim
import torch.nn as nn
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
from torchvision.transforms import Compose
from torchvision.utils import make_grid
from math impor... | Python |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/config.py | .py | 3,957 | 153 | """Experiment Configuration"""
import os
import re
import glob
import itertools
import sacred
from sacred import Experiment
from sacred.observers import FileStorageObserver
from sacred.utils import apply_backspaces_and_linefeeds
sacred.SETTINGS['CONFIG']['READ_ONLY_CONFIG'] = False
sacred.SETTINGS.CAPTURE_MODE = 'no'... | Python |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/util/__init__.py | .py | 0 | 0 | null | Python |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/util/utils.py | .py | 2,004 | 74 | """Util functions"""
import random
import torch
import numpy as np
import os
from datetime import datetime
def try_mkdir(path):
try:
os.mkdir(path)
print(f"mkdir : {path}")
except:
print(f"failed to make a directory : {path}")
def date():
now = datetime.now()
string = now.year + now.month + now.day
... | Python |
3D | oopil/3D_medical_image_FSS | UNet_upperbound/models/decoder.py | .py | 4,107 | 101 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import numpy as np
# from torchsummary import summary
if __name__ == '__main__':
from nnutils import conv_unit
else:
from .nnutils import conv_unit
class Decoder(nn.Module):
def __init__(self, input_channels=512, input_r... | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.