Menu

#24 NullPointerException for color mode B&W

open
nobody
None
5
2014-07-11
2012-08-03
Anonymous
No

I used images from "test_images.zip" to create a 'image recognition' neural network file type. When I select the color mode to 'Black and White' and hit the next button I get a NullPointerException. If I select color mode 'color' then I do not get NullPointerException even though these images appear to be black and white.

Product Version: Neuroph Studio 201104080000 (v2.6)
Java: 1.6.0_24; Java HotSpot(TM) 64-Bit Server VM 19.1-b02
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (neurophstudio)

java.lang.NullPointerException
at org.neuroph.netbeans.ide.project.type.ocr.imr.IMRWizardPanel1.getColorMode(IMRWizardPanel1.java:102)
at org.neuroph.netbeans.ide.project.type.ocr.imr.IMRWizardPanel1.storeSettings(IMRWizardPanel1.java:94)
at org.openide.WizardDescriptor.setValueOpen(WizardDescriptor.java:1352)
at org.openide.WizardDescriptor.setValue(WizardDescriptor.java:1330)
at org.netbeans.core.windows.services.NbPresenter$ButtonListener.actionPerformed(NbPresenter.java:1321)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:148)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
at java.awt.Dialog$1.run(Dialog.java:1046)
at java.awt.Dialog$3.run(Dialog.java:1098)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1096)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:1038)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1072)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1060)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:126)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1361)
at org.openide.util.Mutex.readAccess(Mutex.java:271)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:1045)
at java.awt.Component.show(Component.java:1585)
at java.awt.Component.setVisible(Component.java:1537)
at java.awt.Window.setVisible(Window.java:842)
at java.awt.Dialog.setVisible(Dialog.java:986)
at org.openide.loaders.TemplateWizard.instantiateImpl(TemplateWizard.java:498)
at org.openide.loaders.TemplateWizard.instantiate(TemplateWizard.java:365)
at org.netbeans.modules.project.ui.actions.NewFile.doPerform(NewFile.java:157)
at org.netbeans.modules.project.ui.actions.NewFile.actionPerformed(NewFile.java:129)
at org.netbeans.modules.project.ui.actions.LookupSensitiveAction.actionPerformed(LookupSensitiveAction.java:170)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:148)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Discussion

  • Zoran Sevarac

    Zoran Sevarac - 2012-10-16

    The fix will be avialable in next release very soon.

    In FractionRGBData class:

    public static double[] convertRgbInputToBinaryBlackAndWhite(double[] inputRGB) {
    double inputBinary[]= new double[inputRGB.length/3];

    for(int i=0; i<inputRGB.length; i+=3) {
    if (inputRGB[i]>0) {
    inputBinary[i/3] = 0;
    } else {
    inputBinary[i/3] = 1;
    }
    }

    return inputBinary;
    }

    And in ImageRecognitionHelper

    public static DataSet createBlackAndWhiteTrainingSet(List<String> imageLabels, Map<String, FractionRgbData> rgbDataMap) throws VectorSizeMismatchException
    {
    int inputCount = rgbDataMap.values().iterator().next().getFlattenedRgbValues().length / 3;
    int outputCount = imageLabels.size();
    DataSet trainingSet = new DataSet(inputCount, outputCount);

        for \(Entry&lt;String, FractionRgbData&gt; entry : rgbDataMap.entrySet\(\)\) \{
            double\[\] inputRGB = entry.getValue\(\).getFlattenedRgbValues\(\);
    

    double[] inputBW = FractionRgbData.convertRgbInputToBinaryBlackAndWhite(inputRGB);
    double[] response = createResponse(entry.getKey(), imageLabels);
    trainingSet.addRow(new DataSetRow(inputBW, response));
    }

    return trainingSet;
    }

     
  • Nobody/Anonymous

    whoah this blog is wonderful i love reading your posts. Keep up the great work! You recognize, lots of persons are looking around for this info, you can help them greatly.
    gw2 gold http://www.guildwars2star.com

     
  • Nobody/Anonymous

    LbQofP <a href="http://mhxuopazygmy.com/">mhxuopazygmy</a>, [url=http://qjglmbvpfzsq.com/]qjglmbvpfzsq[/url], [link=http://isfsxrovgbus.com/]isfsxrovgbus[/link], http://xwzkozlvchtj.com/

     
  • Nobody/Anonymous

    I wish to express appreciation to you for bailing me out of this crisis. After looking throughout the the web and obtaining concepts that were not powerful, I was thinking my life was gone. Living without the strategies to the difficulties youve fixed through your entire report is a critical case, as well as ones which might have in a wrong way damaged my career if I had not come across the blog. Your primary talents and kindness in maneuvering all the details was vital. Im not sure what I would have done if I had not come across such a solution like this. Its possible to at this time look ahead to my future. Thanks for your time so much for your specialized and result oriented guide. I will not hesitate to recommend your web sites to anyone who needs guidance about this area.
    <a href="http://eyeuser.com/blogs/viewstory/336769" title="Work with a">Work with a</a>

     
MongoDB Logo MongoDB