import mimo_net
from subpackages import NetworkOptions

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "1"

opts = NetworkOptions.NetworkOptions(
    exp_dir=os.path.normpath(os.path.join(os.getcwd(), 'ExpDir')),
    num_examples_per_epoch_train=1,
    num_examples_per_epoch_valid=1,
    image_height=600,
    image_width=600,
    label_height=600,
    label_width=600,
    crop_height=508,
    crop_width=508,
    in_feat_dim=3,
    in_label_dim=4,
    num_of_classes=2,
    batch_size=1,
    num_of_epoch=500,
    data_dir=os.path.normpath(
        'D:/Shan/MyCodes/TracerX/TissueSegmentation/Data'),
    train_data_filename='TrainData171017.h5',
    valid_data_filename='ValidData171017.h5',
    current_epoch_num=0)

if os.path.isdir(os.path.join(opts.exp_dir, 'code')):
    rmtree(os.path.join(opts.exp_dir, 'code'))
    os.makedirs(os.path.join(opts.exp_dir, 'code'))

if not os.path.isdir(opts.exp_dir):
        d[a[0]] = a[1].strip('\n')

print('results_dir: ' + d['results_dir'], flush=True)
print('file_name_pattern: ' + d['file_name_pattern'], flush=True)
print('date: ' + d['date'], flush=True)
print('exp_dir: ' + d['exp_dir'], flush=True)

opts = NetworkOptions.NetworkOptions(
    exp_dir=d['exp_dir'],
    num_examples_per_epoch_train=1,
    num_examples_per_epoch_valid=1,
    image_height=508,
    image_width=508,
    label_height=508,
    label_width=508,
    in_feat_dim=3,
    in_label_dim=4,
    num_of_classes=2,
    batch_size=1,
    data_dir=data_dir,
    results_dir=d['results_dir'],
    current_epoch_num=0,
    file_name_pattern=d['file_name_pattern'],
    pre_process=True,  #False to disable matlab
)

opts.results_dir = (os.path.join(opts.results_dir, '20171031'))
if not os.path.isdir(opts.results_dir):
    os.makedirs(opts.results_dir, exist_ok=True)
    os.makedirs(os.path.join(opts.results_dir, 'mat'), exist_ok=True)
    os.makedirs(os.path.join(opts.results_dir, 'annotated_images'),
                exist_ok=True)
Exemple #3
0
import sccnn_classifier as sccnn_classifier
from subpackages import NetworkOptions

# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# os.environ["CUDA_VISIBLE_DEVICES"] = "0"

opts = NetworkOptions.NetworkOptions(
    exp_dir='ExpDir-IHC/',
    num_examples_per_epoch_train=1,
    num_examples_per_epoch_valid=1,
    image_height=51,
    image_width=51,
    in_feat_dim=3,
    in_label_dim=1,
    num_of_classes=4,
    batch_size=500,
    data_dir='R:\\tracerx\\Melanoma\\Quad\\data\\cws',
    results_dir='D:/tmp/results_diagostics-ihc/classification',
    detection_results_path=
    'R:\\tracerx\\Melanoma\\Quad\\results\\detection\\20171017',
    tissue_segment_dir='',
    preprocessed_dir=None,
    current_epoch_num=0,
    file_name_pattern='CB12*',
    pre_process=True,
    color_code_file='IHC_CD4_CD8_FoxP3.csv')

opts.results_dir = (os.path.join(opts.results_dir, '20171019'))
opts.preprocessed_dir = os.path.join(opts.preprocessed_dir, '20171019')

if not os.path.isdir(opts.results_dir):
    os.makedirs(opts.results_dir)
print('results_dir: ' + d['results_dir'], flush=True)
print('tissue_segment_dir: ' + d['tissue_segment_dir'], flush=True)
print('file_name_pattern: ' + d['file_name_pattern'], flush=True)
print('date: ' + d['date'], flush=True)
print('exp_dir: ' + d['exp_dir'], flush=True)

opts = NetworkOptions.NetworkOptions(
    exp_dir=d['exp_dir'],
    num_examples_per_epoch_train=1,
    num_examples_per_epoch_valid=1,
    image_height=31,
    image_width=31,
    in_feat_dim=int(d['in_feat_dim']),
    label_height=13,
    label_width=13,
    in_label_dim=1,
    batch_size=90,
    data_dir=data_dir,
    results_dir=d['results_dir'],
    tissue_segment_dir=d['tissue_segment_dir'],
    current_epoch_num=0,
    file_name_pattern=d['file_name_pattern'],
    preprocessed_dir=d['preprocessed_dir'],
    pre_process=True)

opts.results_dir = os.path.join(opts.results_dir, d['date'])
if d['preprocessed_dir'] is None:
    opts.preprocessed_dir = os.path.join(opts.preprocessed_dir, d['date'])

if not os.path.isdir(opts.results_dir):
    os.makedirs(opts.results_dir, exist_ok=True)
        d[a[0]] = a[1].strip('\n')

print('exp_dir: ' + d['exp_dir'], flush=True)
print('train_data_filename:' + d['train_data_filename'], flush=True)
print('valid_data_filename:' + d['valid_data_filename'], flush=True)

opts = NetworkOptions.NetworkOptions(
    exp_dir=d['exp_dir'],
    num_examples_per_epoch_train=1,
    num_examples_per_epoch_valid=1,
    image_height=600,
    image_width=600,
    label_height=600,
    label_width=600,
    crop_height=508,
    crop_width=508,
    in_feat_dim=3,
    in_label_dim=4,
    num_of_classes=2,
    batch_size=1,
    num_of_epoch=500,
    data_dir=data_dir,
    train_data_filename=d['train_data_filename'],
    valid_data_filename=d['valid_data_filename'],
    current_epoch_num=0)

if os.path.isdir(os.path.join(opts.exp_dir, 'code')):
    rmtree(os.path.join(opts.exp_dir, 'code'))
    os.makedirs(os.path.join(opts.exp_dir, 'code'))

if not os.path.isdir(opts.exp_dir):
print('tissue_segment_dir: ' + d['tissue_segment_dir'], flush=True)
print('detection_results_path:' + d['detection_results_path'], flush=True)
print('file_name_pattern: ' + d['file_name_pattern'], flush=True)
print('date: ' + d['date'], flush=True)
print('exp_dir: ' + d['exp_dir'], flush=True)

opts = NetworkOptions.NetworkOptions(
    exp_dir=d['exp_dir'],
    num_examples_per_epoch_train=1,
    num_examples_per_epoch_valid=1,
    image_height=51,
    image_width=51,
    in_feat_dim=int(d['in_feat_dim']),
    in_label_dim=1,
    num_of_classes=int(d['num_of_classes']),
    batch_size=500,
    data_dir=data_dir,
    results_dir=d['results_dir'],
    detection_results_path=d['detection_results_path'],
    tissue_segment_dir=d['tissue_segment_dir'],
    preprocessed_dir=d['preprocessed_dir'],
    current_epoch_num=0,
    file_name_pattern=d['file_name_pattern'],
    color_code_file=d['color_code_file'],
    pre_process=True)

opts.results_dir = os.path.join(opts.results_dir, d['date'])
opts.preprocessed_dir = os.path.join(opts.preprocessed_dir, d['date'])

if not os.path.isdir(opts.results_dir):
    os.makedirs(opts.results_dir, exist_ok=True)
Exemple #7
0
import mimo_net
from subpackages import NetworkOptions

# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# os.environ["CUDA_VISIBLE_DEVICES"] = "1"

opts = NetworkOptions.NetworkOptions(
    exp_dir='ExpDir/',
    num_examples_per_epoch_train=1,
    num_examples_per_epoch_valid=1,
    image_height=508,
    image_width=508,
    label_height=508,
    label_width=508,
    in_feat_dim=3,
    in_label_dim=4,
    num_of_classes=2,
    batch_size=1,
    data_dir='R:\\tracerx\\Melanoma\\Quad\\data\\cws',
    results_dir='R:\\tracerx\\Melanoma\\Quad\\results\\'
    'tissue_segmentation',
    current_epoch_num=0,
    file_name_pattern='*.ndpi',
    pre_process=True,
)

opts.results_dir = (os.path.join(opts.results_dir, '20171019'))
if not os.path.isdir(opts.results_dir):
    os.makedirs(opts.results_dir)
    os.makedirs(os.path.join(opts.results_dir, 'mat'))
    os.makedirs(os.path.join(opts.results_dir, 'annotated_images'))