function config = config_base(results_path, dataset_path)
%% Base Configuration File
% Machine Memory Parameters used for Dictionary Learning
config.max_sample_mem = 32e9; % in bytes
config.max_samples_per_image = 1000; % max number of samples
config.max_total_samples = 1e6; % max number of total samples
config.blk_size = 2^10;

% Labels
data_info.labels = {'grasp', 'cut', 'scoop', 'contain', 'pound', 'support', 'wrap-grasp'};
% Regular expression used to extract tokens
data_info.token_expr = '^(\w+_\d+_\d+)_rgb.jpg$';
% Formats used to construct the original filename from tokens
data_info.rgb_format    = '%s_rgb.jpg';
data_info.depth_format  = '%s_depth.png';
data_info.gtrank_format = '%s_label_rank.mat';

% Registered RGB-D images have missing values on the border
% we crop this portion of the image, and scale to reduce
% computation time. Images can also be transformed to another color space.
load_params.crop = [40 469 20 589]; % crop = [top bottom left right]
load_params.scale = .5;
% For Lab color space conversion.
load_params.color_space = 'rgb'; % 'lab';
load_params.clab = makecform('srgb2lab');
% Depth parameters.
load_params.max_depth = 1.5;    % Cutoff large depths
load_params.center = [320 240]; % used to compute the point cloud
% Default PCL focal length is 525, data was collected using PCL.
load_params.focal_length = [525 525];
% Crop out the background when learning features
load_params.use_gt_box = 1;
load_params.gt_box_border = 16;
load_params.gt_box_min = 128;

% Normal and Curvature paramters
config.normal_params.patch_radius = 5; % Normal filter window radius
config.normal_params.sigma_scale = 9;  % Normal filter sigma
config.curv_params.patch_radius = 3;   % Curvature filter window radius
config.curv_params.n_pairs = 250;      % Curvature filter number of pairs

% Feature pooling type.
config.pool_type = 'max';

% SLIC superpixel segmentation parameters. 
supix_params.max_iter = 10;
supix_params.patch_sz = 12;
supix_params.max_c = 1.00;
supix_params.max_s = 1.00;
supix_params.beta_1 = 0.9;
supix_params.beta_2 = 0.1;

%% Creat HMP Architecture Params
config.raw_feature_types = {
    % feature type,   subdirectory name,   file format,      num_channels
    {'rgb',           '*RAW_RGB',          '%s_rgb.jpg',     3},
    {'gray',          '*RAW_RGB',          '%s_depth.png',   1},
    {'lab',           'lab',               '%s.mat',         3},
    {'lab_l',         'lab',               '%s.mat',         1},
    {'lab_ab',        'lab',               '%s.mat',         2},
    {'depth',         'depth',             '%s.mat',         1},
    {'normals',       'normals',           '%s.mat',         3},
    {'normals-rot',   'normals',           '%s.mat',         3},
    {'normals-2D',    'normals',           '%s.mat',         2},
    {'curvature',     'curvature',         '%s.mat',         2},
    {'shape_index',   'curvature',         '%s.mat',         2}};

%% Model Params
model_params.model_type = 'binary';
model_params.svm_package = 'liblinear';
model_params.learner = 'SVR';
model_params.norm_each_feat = 'L2';
model_params.center_data = 0;
model_params.unit_variance = 0;
model_params.svm_C = [100, 10, 5, 1, 0.1, 0.01, 0.001];
model_params.weight_classes = false;
model_params.remove_unlabeled = false;
model_params.tune_subset = 0.25; % the percentage of data to use when tuning
model_params.max_class_samples = 2500;

%% Folder Paths for Organization
paths.results   = results_path;
paths.dataset   = dataset_path;
paths.img_feats = fullfile(results_path, 'img_feats');
paths.seg_feats = fullfile(results_path, 'seg_feats');
paths.hmp_dicts = fullfile(results_path, 'hmp_dicts');
paths.seg_data  = fullfile(paths.seg_feats, 'seg_data');
paths.depth     = fullfile(paths.img_feats, 'depth');
paths.normals   = fullfile(paths.img_feats, 'normals');
paths.curvature = fullfile(paths.img_feats, 'curvature');
make_directory_structure(paths);

config.paths = paths;
config.data_info = data_info;
config.load_params  = load_params;
config.supix_params = supix_params;
config.model_params = model_params;
