import json
import utils
import os

with open('SETTINGS.json') as data_file:
    paths = json.load(data_file)

METADATA_PATH = paths["METADATA_PATH"]
utils.check_data_paths(METADATA_PATH)

PREDICTIONS_PATH = paths["PREDICTIONS_PATH"]
utils.check_data_paths(METADATA_PATH)

DATA_PATH = paths["DATA_PATH"]
utils.check_data_paths(DATA_PATH)

# VALIDATION_SPLIT_PATH = paths["VALIDATION_SPLIT_PATH"]
# if not os.path.isfile(VALIDATION_SPLIT_PATH):
#     raise ValueError('no validation file')
Пример #2
0
import json
import utils
import os
import slice2roi

with open('../SETTINGS.json') as data_file:
    paths = json.load(data_file)

SUBMISSION_NR = paths["SUBMISSION_NR"]
METADATA_PATH = paths["METADATA_PATH"]
PREDICTIONS_PATH = paths["PREDICTIONS_PATH"]
SUBMISSION_PATH = paths["SUBMISSION_PATH"]

TRAIN_DATA_PATH = paths["TRAIN_DATA_PATH"]
PKL_TRAIN_DATA_PATH = paths["PKL_TRAIN_DATA_PATH"]
utils.check_data_paths(TRAIN_DATA_PATH, PKL_TRAIN_DATA_PATH)

VALIDATE_DATA_PATH = paths["VALIDATE_DATA_PATH"]
PKL_VALIDATE_DATA_PATH = paths["PKL_VALIDATE_DATA_PATH"]
utils.check_data_paths(VALIDATE_DATA_PATH, PKL_VALIDATE_DATA_PATH)

TRAIN_LABELS_PATH = paths["TRAIN_LABELS_PATH"]
if not os.path.isfile(TRAIN_LABELS_PATH):
    raise ValueError('no file with train labels')

# TODO: next time move this a better place
if not os.path.isfile('pkl_train_slice2roi.pkl'):
    print 'Generating ROI'
    slice2roi.get_slice2roi(PKL_TRAIN_DATA_PATH, 'pkl_train_slice2roi.pkl')

if not os.path.isfile('pkl_validate_slice2roi.pkl'):
Пример #3
0
import json
import utils
import os
import slice2roi

with open('../SETTINGS.json') as data_file:
    paths = json.load(data_file)

SUBMISSION_NR = paths["SUBMISSION_NR"]
METADATA_PATH = paths["METADATA_PATH"]
PREDICTIONS_PATH = paths["PREDICTIONS_PATH"]
SUBMISSION_PATH = paths["SUBMISSION_PATH"]

TRAIN_DATA_PATH = paths["TRAIN_DATA_PATH"]
PKL_TRAIN_DATA_PATH = paths["PKL_TRAIN_DATA_PATH"]
utils.check_data_paths(TRAIN_DATA_PATH, PKL_TRAIN_DATA_PATH)

VALIDATE_DATA_PATH = paths["VALIDATE_DATA_PATH"]
PKL_VALIDATE_DATA_PATH = paths["PKL_VALIDATE_DATA_PATH"]
utils.check_data_paths(VALIDATE_DATA_PATH, PKL_VALIDATE_DATA_PATH)

TRAIN_LABELS_PATH = paths["TRAIN_LABELS_PATH"]
if not os.path.isfile(TRAIN_LABELS_PATH):
    raise ValueError('no file with train labels')

# TODO: next time move this a better place
if not os.path.isfile('pkl_train_slice2roi.pkl'):
    print 'Generating ROI'
    slice2roi.get_slice2roi(PKL_TRAIN_DATA_PATH, 'pkl_train_slice2roi.pkl')

if not os.path.isfile('pkl_validate_slice2roi.pkl'):
if utils.hostname() == 'user':
    with open('SETTINGS_user.json') as data_file:
        paths = json.load(data_file)
else:
    with open('SETTINGS.json') as data_file:
        paths = json.load(data_file)

# kaggle data
STAGE = int(paths["STAGE"])

if STAGE == 1:
    METADATA_PATH = paths["METADATA_PATH_1"]

    DATA_PATH = paths["DATA_PATH_1"]
    utils.check_data_paths(DATA_PATH)

    SAMPLE_SUBMISSION_PATH = paths["SAMPLE_SUBMISSION_PATH_1"]
    if not os.path.isfile(SAMPLE_SUBMISSION_PATH):
        raise ValueError('no stage 1 sample submission file')

elif STAGE == 2:
    METADATA_PATH = paths["METADATA_PATH_2"]

    DATA_PATH = paths["DATA_PATH_2"]
    utils.check_data_paths(DATA_PATH)

    SAMPLE_SUBMISSION_PATH = paths["SAMPLE_SUBMISSION_PATH_2"]
    if not os.path.isfile(SAMPLE_SUBMISSION_PATH):
        raise ValueError('no stage 2 sample submission file')
Пример #5
0
if utils.hostname() == 'user':
    with open('SETTINGS_user.json') as data_file:
        paths = json.load(data_file)
else:
    with open('SETTINGS.json') as data_file:
        paths = json.load(data_file)

# kaggle data
STAGE = int(paths["STAGE"])

if STAGE == 1:
    METADATA_PATH = paths["METADATA_PATH_1"]

    DATA_PATH = paths["DATA_PATH_1"]
    utils.check_data_paths(DATA_PATH)

    SAMPLE_SUBMISSION_PATH = paths["SAMPLE_SUBMISSION_PATH_1"]
    if not os.path.isfile(SAMPLE_SUBMISSION_PATH):
        raise ValueError('no stage 1 sample submission file')

elif STAGE == 2:
    METADATA_PATH = paths["METADATA_PATH_2"]

    DATA_PATH = paths["DATA_PATH_2"]
    utils.check_data_paths(DATA_PATH)

    SAMPLE_SUBMISSION_PATH = paths["SAMPLE_SUBMISSION_PATH_2"]
    if not os.path.isfile(SAMPLE_SUBMISSION_PATH):
        raise ValueError('no stage 2 sample submission file')