Tuesday, August 8, 2017

Finale

So, it is done. Well, for the requirements that this class, it has. And it works! For the most part. Let's get into it.

Final Stages

So I have the GUI built up correctly, and drawing properly. In the pictures below, I have the drawing area and the main pages, basically how I draw out the numbers and save them off.















As I draw, I figured out how to save off the numbers, basically I just save off the center point of each circle I drew into an array and wrote it out to a file to be used by Weka.

Thoughts

All in all, I am fairly happy with the results of the "end" product. There is still some work that I want to do on it in terms of optimization and parallelization. Currently, the Neural Network takes about 20 minutes to build with only 30 different images. Along with all of that, the Neural Network is only correct about a third of the time, so there is work to do with it.

Future work?

There are three possible things that I want to be able to do in the future.

The first is trying to parallelize it, possibly by using OpenGL or CUDA processing, but I will have to look into it quite a bit more.

Second would be optimizing it. Right now my largest problem is actually how large the problem is. Because of how I have things set in Java, my drawing aread is 250x450 pixels, giving me about 112,501 data points in each photo, and that many input nodes in the Neural Network. Needless to say, this is quite a bit of an issue. What I would like to do first is fix the GUI so that the drawing area is quite a bit less, probably 200x200 pixels. After that I would like to see about optimizing it further, changing how the drawing is saved and testing different ways on that.

Third, I would like to try and write the Neural Network myself rather than relying on Weka's example, even though they are pretty well written.

Tuesday, May 30, 2017

5/23 Post from the Future

I have been pretty bad at updating these posts as I am working, so here is a post from a week ago for 5/23.

For the week of 5/23, I got a few things accomplished. First of all I fixed the issue that I had the previous week of not getting the neural network to train properly. That took me awhile to figure out what I was doing incorrectly, it turns out that instead of '?' I needed the actual number to test against, who knew!

After I figured that out I was kind of tired of playing with the files in everything, so I started looking into the drawing aspect of the program that I want. Using the files that Sherri had given me, I was able to make a little bit of progress in figuring out what I need to do with that. I had not gotten to the part of the program where I would save off the data, that is yet to come.

5/16 Post from the Future

I have been pretty bad at updating the blog here, so this is a post about what I accomplished a few weeks ago.

For the week of 5/16, I started using the files Sherri had given me for the test data of number files.
I had an issue with the way I was formatting everything, which I figured out the over the course of the next week.


Wednesday, May 10, 2017

Summer Plan

Because of all the changes I had made with my project plan, I have received a bit of an extension on my project. This specific post is to lay out a plan that I will follow as closely as I can this summer in order to accomplish what I need to. I will be meeting every Tuesday around the Noon hour with Sherri, and going over my progress and making sure I am on track with what I am supposed to do.


Tuesday 5/16/2017

By this date I will have used the data Files that Sherri gave me and read through and test off of them. This will allow me to have a better understanding of how the neural network itself works. This will also help me to understand what all the file structure and use is like within Java.

Tuesday 5/23/2017

This day I want to build up the neural network using Sherri's data, and then rather than spit a report of how well the neural network tests, have it spit out what it thinks a character is from the file.

Tuesday 5/30/2017

On this day I want to have progress made on actually drawing out characters of my own and saving it to a file.

Tuesday 6/6/2017

By now I hope to have completed the project to the degree that I should have by the end of the semester. Using my own data that I have built up  in order to build and test from a neural network.

Monday, May 1, 2017

Weka Work

File Structure and Weka Use

Using Weka within Java seems to have been a grand idea. Currently I have it build off a neural net using data that I faked to represent entirely white and entirely black 50pixel x 50pixel data. Within Java I can write to a CVS file, and using the Weka libraries I can change it to an arff file, which is what it uses in order to capture and use all the data in a good format. From Weka as a program, here are the files that I have been using in my project path, and can manipulate them however I wish.



GUI Work


I have worked on the basic GUI layout that I want, and it is going rather well. The issue I have right now is drawing on the JFrame that I want to, and displaying things differently depending on what I am doing, training or testing. Currently I have it set to choose between either testing or training, and then having buttons to save clear and exit. I need to implement drawing on those specific frames, and once I get that done there is data work to do.

Data Work

The work I need to do with data once I get the drawing done should not be too difficult. It is merely writing to a file the pixel data and then what letter is represented, then converting that file back to the Weka arff format. Because of the way I have the data set up currently, it should not be much of an issue.

Looking forward

For now, what my main course of work is consists of getting to know the Weka libraries and API better, in order to understand how exactly they use and build up their Neural Net. In the future I may re-implement what they are doing in my own code, but we shall see in the future what I will do.

Wednesday, April 26, 2017

Another Change

Issues

So after working with the python stuff that I had found, I was having a lot of issues. The first of these, and main cause for the second switch that I will be talking on, is that there were a lot of libraries and packages that I could not get to work properly within my IDE. Theano and the packages to read pkl files were the issues I had, if that is a question. 

Along with those issues, I was having issues with Python and drawing within a window in order to get characters.

New Direction

Given these issues, and talking and hearing from Sherri, I decided to go back to Java, but to use the Weka API instead of a Neuroph API. This should give me a much easier way to go about this. 

 Storing Data

I put a bit of time into how I will be storing data for training and testing. After using the pkl files and learning about how they work, I tried to see if there was a way to use the pkl file that was given in the python libraries that I was using, and there is but it is fairly difficult to implement.

Because of the difficulties I was having with that, I decided that I will just save all of the data as a CSV file, with each row being a different image, and the pixel information in order in each "cell" and with what character it is at the end. I will store training and testing data the same way, but in different files that way I can easily tell the difference between the two.

Current Progress

Right now, currently where I am at is programming the GUI in front, because this is a fairly heavy GUI project. My current issue is getting something similar to paint to work for drawing the characters out. I need a bit of work yet, but once I get drawing down I need to build my image library in order to start testing.

Wednesday, April 12, 2017

Post 2 - Digging In

Change of Implementation

So, after digging into Neuroph a little more, I could not get it to build out a network the way that it is supposed to build them out. It would just hang after clicking the finish button, as shown below, even after letting it sit for close to eight hours.



Learning that, and having it hang the way it would, I started searching around for something else to use, and found a really nice introduction to neural nets online, with some example code. This can all be found here, and I will be looking at the code the author posted on GitHub, but not using it myself.

From what I have been looking at there, the author has test data built in to it, and files built up to read in and use the data. I will likely be using this in able to do back propagation on the neural network, and to build up and train the network.


Current Direction

With all of the above in mind, I have decided to implement everything myself rather than using a framework. I will be implementing this all in Python using the IntelliJ platform with Python plugins. Doing this as well also lets me host everything to GitHub, which it will be a private repository for the time being.

This semester, I will be recognizing a single character at a time, rather than whole words or anything such as that. The hope will be to write out a character with a mouse, or touch tablet that I will be using, and have the program return the character that is written. In the future I will probably be expanding this to read whole words or more if the project goes well.

Concerns

At the current time, I am not sure if I have to train the neural network every time I go to test and run the neural network. This could be annoying and a rather large hassle, especially considering there are thousands of test files to take into consideration, so I will be looking into ways to store the network once it is trained. I am thinking about building the network and using a file to store all of the weights and biases, but I am not sure.

Monday, April 10, 2017

Post 1 - Introduction

Neural Network Thoughts

Throughout this semester, I have been reading quite a bit about neural networks, and have been really curious about them. Seeing the things that people have done with them, like voice recognition and replication, as well as image recognition makes them really useful if implemented in the way you want them to be used.

With all of this in mind, I knew I wanted to do something with neural networks. Reading through about neural networks, I decided to try and make my own handwritten text recognition network. Reading through everything, this seems like a good first step to implement. It is challenging enough that it will make me actually learn how neural networks work and perform, while being easy enough that it won't scare me away.

At the moment, I am looking into Neuroph, which is a java framework for Neural Networks. It seems that it is a well built framework for neural networks, and even has its own quick start for handwriting recognition.