JavaNNS - Parsing the created Neural Network - java

I'm currently working on a Neural Network for creating a "better" PNG Predictor (Prefilter).
I already created the network (with JavaNNS) which has a quite good learning rate on 8-Bit grayscale images.
Now my next step would be to include this created network in my prepared PNG Encoder/Decoder which is written in Java. But to do that I need to parse the created .net file from JavaNNS.
I don't want to invent the wheel again so is there any chance that another one of you has already written a simple parser for the .net files of the JavaNNS which would read all the layers with the neurons, the connections and the weights on the connections and store it in any usable Java data structure?
I know it isn't that hard to create a parser, but it would be awesome to save time and skip this "boring" task.. :)
Thanks!

JavaNNS's predecessor, SNNS (alternative link), had an export function which exported the trained network as C code (essentially a header and source file pair). These files could then be used in custom code.
In Java you could use JNI or JNA to call C code and I am sure there are threads here on SO how to accomplish this.
I do not know the current version of JavaNNS, but maybe they already provide an export function exporting the network as Java code instead of C? Or you could open your trained network in the old SNNS and export it?

I just wanna add that I've created my own .net (JavaNNS) File Parser in Java. It is possible to parse single hidden layer networks. If anyone needs the code who run into the same problem I had before I am happy to share my code.
You can contact me on my blog. Here is the post about the Neural Network Project I've done. Just let a comment there and I will provide you the JavaNNS Parser and the corresponding NeuralNetwork Class.
http://prineblog.wordpress.com/2011/06/21/neural-network-as-predictor-for-image-coding-png/

I just updated the Version of Nen to Beta - It is a lightweight 3-layer neural network implementation in Java for regression and classification. A little performance comparison against support vector machines (LibSVM) demonstrates its capabilities. It can be used via command line or Java.

Related

How can i use Java to call an existing RPG screen program?

I have existing RPG4 programs with green screens, i would like to be able to call the rpg programs with Java and bypass the green screens.
I have done some research on this and IBM OAR (Open Access: RPG) keeps coming up. but i have not found a working example yet.
My goal is to create a web app to collect the the same information and feed it to the back end RPG
any help would be greatly appreciated
EDIT
Delete: You can't.
Insert: A beginner will need to master several complex new concepts before tackling this.
END-EDIT
At least, not without changing the RPG program. Web requests are processed by server jobs, which run in batch - they are not connected to a 5250 terminal. Because they aren't connected to a terminal, when the RPG program tries to open the display file, it will fall over because there's no terminal to attach to.
In order for this to work you'd have to alter the RPG program to not try display file I/O if called by a batch process like a Java app (although Java isn't necessary in this web scenario).
One way to change the RPG program is to use input parameters; if you have them, then don't try to open the display file, but stuff the input parameters into the fields where the display file would have done. Since a display file also outputs from the program you'd need to reserve some parameters for the output information as well. This could get very ugly if a subfile is involved, as there would be potentially thousands of parameters.
OAR comes into the picture because one can write an OAR handler that continues to use the same display file I/O operations, but to direct the actual I/O elsewhere, like STDIN and STDOUT for an HTTP type application. Jon Paris and Susan Gantner have written an article called Getting a Handle on RPG's Open Access which you might find helpful. It's in the July 2010 e-edition of IBM Systems Magazine.
Better perhaps is to extract the business logic in the RPG program, implement it as stored procedures which can be called by the web application via traditional ODBC / JDBC. One can write stored procedures in RPG, so that's not as hard as it might seem.
OAR is probably going to be your best bet....
However, every example I can think of that I've seen has resolved around building a handler to replace a printer file (PRTF) or physical file (PF).
Replacing a display file (DSPF) is a whole other ball game. Primarily because the 5250 protocol is an "intelligent" protocol; unlike dumb character type protocols such as used by ANSI/VT100.
It certainly can and had been done. If you have a single basic screen, you might be able to do it. But for a complex application with multiple screens and subfiles you'll probably have a tough time. Especially if you don't have a in depth understanding of the 5250 protocol.
I'd recommend you take a look at one of the vendor toolset designed to use OAR to replace a 5250 screen with a web page. Those vendors have put years of time and effort into developing the handler needed.
http://www.profoundlogic.com/solutions/rpg-application-modernization.html
https://asna.com/us/products/wings
You might find the following publication useful:
Modernizing IBM i Applications
Lastly note that ROA isn't the only option. There's an older technique, "screen scraping" in which your application basically emulates a 5250 terminal. It's simpler than a full ROA handler, but the end result is simpler also. IBM has it's own tool, HATS. And for instance Profound logic also has a tool, GENIE. But you could conceivably build your own screen scraper, the opensource TN5250J would probably be a place to start. But even this would be non-trivial.
You should use a mix of parsin json on the iseries(this eliminates the subfile problems), one good javascript framework( I've used Extjs) and The Apache server for I.
I've developed a HTTP services framework based on json parameters send directly from the browser using Ajax, processing each request with any ILE language program(mostly rpgle) and returning the result in pure json created inside the program. With this approach, you just send/receive business data, leaving the front-end to the Javascript framework.
Hope this helps. Contact me if you need more help.

TWAIN/WIA example for java

I am developing a java application that can search my system and find all the scanners and lets me select if there are more than one scanner installed and proceed for scanning the document. I understand i should use twain for this. I have a library file in my system path but i have no idea how do i use this. Are there any sample programs on how to use this in my java application.
I have found the below sample code that uses WIA for communicating with the scanners. Is there any jar file to import to my netbeans or is there any other way out.
WIA.DeviceManager manager = new WIA.DeviceManagerClass();
string deviceName = "";
foreach (WIA.DeviceInfo info in manager.DeviceInfos)
{
if (info.Type == WIA.WiaDeviceType.ScannerDeviceType)
{
foreach (WIA.Property p in info.Properties)
{
if (p.Name == "Name")
{
deviceName = ((WIA.IProperty)p).get_Value().ToString();
Console.WriteLine(deviceName);
}
}
}
}
I'm not sure what library you're using, but I'd recommend one of these two:
Morena (low price, good documentation and email correspondence):
http://www.gnome.sk/index.html
mm's computing (open-source LGPL)
http://thorntonzone.com/manuals/Compression/Fax,%20IBM%20MMR/MMSC/mmsc/uk/co/mmscomputing/device/twain/index.html
If you're willing to pay a small price I'd recommend Morena. With Morena 6 (TWAIN) I was able to make a scan applet (called externally) that returns base64 jpeg data, and only ended up with 145 lines of my own Java code. On top of that they have full working examples and a very good FAQ page that covered almost every error I encountered. I haven't played with mms computing's plugin much because I didn't find out about it until after the Morena project was done.
It is really difficult for someone to make such decisions without knowing a lot about what we are dealing with. First let me shed some light on it.
Every Scanner device comes with a custom scan driver. These drivers either use TWAIN or WIA for communicating with the applications that use the drivers. In other words for all the applications that use these drivers there are two protocols that has to be followed:
WIA : https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx
TWAIN: http://www.twain.org/
Trust me you do not want to get in to the details of these.
So your goal would be to use on one of the protocols in your application to query the devices. The code bit you have pasted is a WIA c# sample app that queries and lists all the WIA only drivers installed on the machine.
I would really suggest you to use TWAIN as WIA is completely based on COM and for someone outside C++ world its quite difficult and also I'm not sure if WIA protocol supports TWAIN but the other way round is suppose to work.
If I were to do something like you I would consider writing a custom wrapper for TWAIN in Java like a interop in C# world. TWAIN is supposed to be easier compared to WIA.
In case of any confirmation required feel free to ask.
Thanks!
It's C# code. To make JVM and CLR work together, you can use jni4net to wrap the code block. You can read the article Java TWAIN with Dynamic .NET TWAIN and jni4net to learn how to call .NET code in Java.

Pre-process client's local csv file data into an array using Java and GWT

I've searched and searched, coming across questions that address parts of the problem, but nothing comprehensive. I'm using GWT and eclipse to develop a website that uses highcharts to make some fancy plots.
The idea is that the user will be able to select one of their local data files of type csv and upon selection of the file, the plot will be rendered using their data and our fancy algorithms.
We don't want to send enormous amounts of data to the server as this will become costly and time consuming for the user. Is there a way to process or at least pre-process the user's data using Java code to be implemented in a GWT-eclipse project?
Any help is greatly appreciated!
This is a duplicate of GWT Toolkit: preprocessing files on client side
One of the answers points to these links:
http://code.google.com/p/gwt-nes-port/wiki/FileAPI - GWT wrapper for HTML5 File API
http://www.html5rocks.com/en/tutorials/file/dndfiles/ - HTML5 FileAPI
But, alas, the FileAPI is pretty new: http://caniuse.com/fileapi
The other alternative you have, to avoid server, is a text area to paste the CSV file into, then read that using GWT. This is a common trick and I think you can even copy+paste from certain spreadsheet programs this way.
You cannot do it in a universal way in GWT in all browsers currently. GWT translates to javascript and it does not have the required privileges to process client side the files.
For more detailed answer you can reference - How to retrieve file from GWT FileUpload component?

How to Create a .dst Embroidery File using Java

I want to create a .dst embroidery file using Java. Are there any supporting libraries available? Or is it possible to convert any kind of image file to the .dst embroidery file format using Java?
Can anyone suggest any algorithms, encoding-decoding methods, etc?
I am the developer at Embroidermodder working on formats (the link mentioned by theJollySin).
I don't have any Java code, but I can point you to some preliminary documentation of the format (http://www.achatina.de/sewing/main/TECHNICL.HTM).
What are you trying to create in DST? I can assist you with whatever issues you have getting your Java code running.
The short answer to your question is, no. There are currently no popular libraries for generating .dst embroidery files with Java. My guess is that you will have a lot more luck trying to convert other file types to the .dst formats. The only option there (that I know of) is Corel Draw.
In the end, the best solution I can think of is to use the Tajima Ambaasador website. You have to register, but I believe most of their design/DST services are free.
(After some searching around online I also found this website, which has some more free software and seems like the best place to start if you're looking for information.)
Yes. I've written exactly such a library for python (pyembroidery) and trancoded that to java. It will work for both Android and Oracle Java and has fully fleshed out reading and writing of most major embroidery formats.
https://github.com/EmbroidePy/EmbroideryIO
As part of a parallel project I've also done a considerable amount of work documenting various formats for a wiki on the topic. Located here:
https://edutechwiki.unige.ch/en/Embroidery_format
Which also has all the known technical details for DST file formats:
https://edutechwiki.unige.ch/en/Embroidery_format_DST
As for the second part of the question, embroidery files are vector-like files which provides a series of commands to be issued to an embroidery machine. You cannot directly convert raster-based image files to embroidery because the pixel information does not directly convert to any sort of embroidery machine command instruction structure.

1-D barcode scanner(using images from a capturing device) implementation in java

I am a student and as a project i have to implement a barcode(1-D) based attendance marking system.While surfing across the web i came to know that barcode readers are a bit costly toys to purchase,so now what I want to do is I want to capture images of barcodes through a capturing device(mostly a webcam) and then process them to get the content stored in it.
I found a few projects on the internet that do the same but they use .NET f/w and I am not so familiar with .NET technology. The only project that uses java is http://sourceforge.net/projects/javabarcoderead/ but somehow i am not able to run the jar file they are providing.
SO, I would like to know about the algorithms or methods that can be used for the same or even any project from where i can get some insight on how to move further with this...
Happy Coding...
You're right, it would be very difficult to use a library with no documentation and no source code.
I'd suggest using ZXing. It's a well-documented library with lots of examples.

Categories

Resources