2 * svrt is the ``Synthetic Visual Reasoning Test'', an image
3 * generator for evaluating classification performance of machine
4 * learning systems, humans and primates.
6 * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
7 * Written by Francois Fleuret <francois.fleuret@idiap.ch>
9 * This file is part of svrt.
11 * svrt is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 3 as
13 * published by the Free Software Foundation.
15 * svrt is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with selector. If not, see <http://www.gnu.org/licenses/>.
35 #include "vision_problem_1.h"
36 #include "vision_problem_2.h"
37 #include "vision_problem_3.h"
38 #include "vision_problem_4.h"
39 #include "vision_problem_5.h"
40 #include "vision_problem_6.h"
41 #include "vision_problem_7.h"
42 #include "vision_problem_8.h"
43 #include "vision_problem_9.h"
44 #include "vision_problem_10.h"
45 #include "vision_problem_11.h"
46 #include "vision_problem_12.h"
47 #include "vision_problem_13.h"
48 #include "vision_problem_14.h"
49 #include "vision_problem_15.h"
50 #include "vision_problem_16.h"
51 #include "vision_problem_17.h"
52 #include "vision_problem_18.h"
53 #include "vision_problem_19.h"
54 #include "vision_problem_20.h"
55 #include "vision_problem_21.h"
56 #include "vision_problem_22.h"
57 #include "vision_problem_23.h"
59 #define NB_PROBLEMS 23
61 VignetteGenerator *new_generator(int nb) {
62 VignetteGenerator *generator;
66 generator = new VisionProblem_1();
69 generator = new VisionProblem_2();
72 generator = new VisionProblem_3();
75 generator = new VisionProblem_4();
78 generator = new VisionProblem_5();
81 generator = new VisionProblem_6();
84 generator = new VisionProblem_7();
87 generator = new VisionProblem_8();
90 generator = new VisionProblem_9();
93 generator = new VisionProblem_10();
96 generator = new VisionProblem_11();
99 generator = new VisionProblem_12();
102 generator = new VisionProblem_13();
105 generator = new VisionProblem_14();
108 generator = new VisionProblem_15();
111 generator = new VisionProblem_16();
114 generator = new VisionProblem_17();
117 generator = new VisionProblem_18();
120 generator = new VisionProblem_19();
123 generator = new VisionProblem_20();
126 generator = new VisionProblem_21();
129 generator = new VisionProblem_22();
132 generator = new VisionProblem_23();
135 cerr << "Can not find problem "
141 generator->precompute();
156 void svrt_generate_vignettes(int n_problem, int nb_vignettes, long *labels,
157 VignetteSet *result) {
160 if(n_problem < 1 || n_problem > NB_PROBLEMS) {
161 printf("Problem number should be between 1 and %d. Provided value is %d.\n", NB_PROBLEMS, n_problem);
165 VignetteGenerator *vg = new_generator(n_problem);
166 result->n_problem = n_problem;
167 result->nb_vignettes = nb_vignettes;
168 result->width = Vignette::width;
169 result->height = Vignette::height;
170 result->data = (unsigned char *) malloc(sizeof(unsigned char) * result->nb_vignettes * result->width * result->height);
172 unsigned char *s = result->data;
173 for(int i = 0; i < nb_vignettes; i++) {
174 if(labels[i] == 0 || labels[i] == 1) {
175 vg->generate(labels[i], &tmp);
177 printf("Vignette class label has to be 0 or 1. Provided value is %ld.\n", labels[i]);
181 int *r = tmp.content;
182 for(int k = 0; k < Vignette::width * Vignette::height; k++) {