function results = evaluate_cornell_detection(config, file_info, feat_types, model);
fprintf('Evaluating Cornell Recognition.\n');
config.model_params.max_img_samples = Inf;

pos_ind = find(model.svm.Label == 1);
results = zeros(file_info.num_files, 1);
n_pos = zeros(file_info.num_files, 1);
n_neg = zeros(file_info.num_files, 1);
parfor file_i = 1:file_info.num_files
    % File name and paths
    [parent_dirs, name_root] = get_file_info_entry(file_info, file_i);
    [seg_x, seg_gt, ~, seg_id] = ...
        aggregate_box_features(parent_dirs, name_root, config, feat_types);

    [~, ~, scores] = test_svm(model.svm, model.params, seg_x');

    [max_score, max_i] = max(scores(:,pos_ind));
    results(file_i) = seg_gt(max_i);
    n_pos(file_i) = sum(seg_gt == 1);
    n_neg(file_i) = sum(seg_gt == 0);
end
fprintf('Detection accuracy: % 5.2f%%\n', mean(results)*100);
fprintf('Chance accuracy:    % 5.2f%%\n', sum(n_pos)/(sum(n_pos) + sum(n_neg))*100);
end
