@Override @FXML void initialize() { super.initialize(); setUpChoice(algorithm, learners.getTypeNames()); setUpChoice(trainingSet, videos.getVideoChoices()); train.setOnAction(e -> train()); for (Move move : Move.values()) { category.getItems().add(move); } }
@FXML void train() { try { learner = learners.newInstanceOf(algorithm.getSelectionModel().getSelectedItem()); BlockingQueue<Duple<Move, AdaptedYUYVImage>> imgs = new ArrayBlockingQueue<>(1); startProducerThread(trainingSet.getSelectionModel().getSelectedItem(), imgs); label.setTextFill(Color.BLACK); label.setText("0"); startConsumerThread( imgs, mImg -> { Platform.runLater( () -> { label.setText(Integer.toString(Integer.parseInt(label.getText()) + 1)); learner.train(mImg.getSecond(), mImg.getFirst()); }); }); } catch (InstantiationException e) { reportProblem(e); } catch (IllegalAccessException e) { reportProblem(e); } }