Package org.neuroph.util.plugins

Examples of org.neuroph.util.plugins.LabelsPlugin


   * Creates an instance of empty neural network.
   */
  public NeuralNetwork() {
    this.layers = new ArrayList<Layer>();
    this.plugins = new HashMap<Class, PluginBase>();
    this.addPlugin(new LabelsPlugin())
  }
View Full Code Here


 
  @Override
  public String toString() {
    if (plugins.containsKey("LabelsPlugin")) {
      LabelsPlugin labelsPlugin = ((LabelsPlugin)this.getPlugin(LabelsPlugin.class));
      String label = labelsPlugin.getLabel(this);
      if (label!=null) return label;
    }
   
    return super.toString();
  }
View Full Code Here

   * recogition result as value
   *
   * @return image recognition result
   */
  public HashMap<String, Double> getOutput() {
    LabelsPlugin labelsPlugin = (LabelsPlugin) this.getParentNetwork()
        .getPlugin(LabelsPlugin.class);
    HashMap<String, Double> networkOutput = new HashMap<String, Double>();

    for (Neuron neuron : this.getParentNetwork().getOutputNeurons()) {
      String neuronLabel = labelsPlugin.getLabel(neuron);
      networkOutput.put(neuronLabel, neuron.getOutput());
    }

    return networkOutput;
  }
View Full Code Here

    for (Neuron neuron : this.getParentNetwork().getOutputNeurons()) {
      if (neuron.getOutput() > maxNeuron.getOutput())
        maxNeuron = neuron;
    }

    LabelsPlugin labels = (LabelsPlugin) this.getParentNetwork().getPlugin(
        LabelsPlugin.class);

    maxOutput.put(labels.getLabel(maxNeuron), maxNeuron);

    for (Neuron neuron : this.getParentNetwork().getOutputNeurons()) {
      if (neuron.getOutput() == maxNeuron.getOutput()) {
        maxOutput.put(labels.getLabel(neuron), neuron);
      }
    }

    return maxOutput;
  }
View Full Code Here

        /**
         * Adds neural network
         * @param neuralNet
         */
  public void addNetwork(NeuralNetwork neuralNet) {
    LabelsPlugin labelsPlugin = ((LabelsPlugin)neuralNet.getPlugin(LabelsPlugin.class));
    String label = labelsPlugin.getLabel(neuralNet);
    neuralNets.put(label, neuralNet);
  }
View Full Code Here

         * @param neuralNetwork neural network
         * @param imageLabels image labels
         */
  private static void assignLabelsToOutputNeurons(NeuralNetwork neuralNetwork, List<String> imageLabels) {
    List<Neuron> outputNeurons = neuralNetwork.getOutputNeurons();
    LabelsPlugin labelsPlugin = (LabelsPlugin) neuralNetwork.getPlugin(LabelsPlugin.class);
   
    for(int i=0; i<outputNeurons.size(); i++) {
      Neuron neuron = outputNeurons.get(i);
      String label = imageLabels.get(i);
      neuron.setLabel(label);
View Full Code Here

TOP

Related Classes of org.neuroph.util.plugins.LabelsPlugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.