public Brain createFromTrainSet(String path, int setSize, boolean verbose)
			throws Exception {
		// The trainings data
		DataSet trainSet; // could be TrainingSet<TrainingElement>
		List<String> labels = new ArrayList<String>();
		Map<String, FractionRgbData> images;

		// The network
		NeuralNetwork net;
		// The network properties
		Dimension dimension = new Dimension(imageWidth, imageHeight);
		ColorMode colorMode = ColorMode.BLACK_AND_WHITE;

		// TODO load files from path
		File dir = new File(path);
		if (!dir.isDirectory()) {
			throw new Exception("Please specify a directory");
		}

		String label;
		File[] content = dir.listFiles();
		images = new HashMap<String, FractionRgbData>();

		if (verbose) {
			System.out.println("processing dir " + dir.getName());
		}

		for (File directory : content) {
			if (verbose) {
				System.out.println("processing dir " + directory.getName());
			}

			if (!directory.isDirectory()) {
				throw new Exception("The directory has to contain directories");
			}

			images.putAll(ImagesLoader.getFractionRgbDataForDirectory(
					directory, dimension, setSize));

			label = directory.getName();
			labels.add(label);
		}

		trainSet = ImageRecognitionHelper.createBlackAndWhiteTrainingSet(
				labels, images);

		// redirect output to nirvana
		PrintStream original = null;
		if (!verbose) {
			original = System.out;
			System.setOut(new PrintStream(new OutputStream() {
				public void write(int b) {
					// DO NOTHING
				}
			}));
		}
		net = ImageRecognitionHelper.createNewNeuralNetwork(netLabel,
				dimension, colorMode, labels, hiddenLayers,
				TransferFunctionType.SIGMOID);

		// change redirection back to original
		if (original != null) {
			System.setOut(original);
		}
		
		if (verbose) {
			System.out.println("New Network of type "
					+ net.getClass().getCanonicalName());
		}

		net.learn(trainSet, getLearningRule());
		// learnInNewThread();

		return new Brain(net);
	}