I'm going to cluster the features of each image and take the medioid of the clusters to be representative features. If need be, I'll take a few random outliers to complete the set. I've made a csv list of the cleaned keys, the keys of the images that had between 300 and 1200 keypoints. I'm going to take that list and break it up into 300 individual parts so that it can be clustered by Matlab. I might figure out some batch method in Weka and use that to cluster the features for each image.
%%%%%
Dude, omg. I found Ruby for Scientific Computing and I think it might save my balls on this project. There's a post about using jRuby and WEKA and I think I might go that route. I just unistalled WEKA. I was having trouble accessing it by `java -jar weka.jar`. I had originally downloaded via my synaptic package manager, and I think it installed it so that I could pull it up with just `weka`, but all the code snippets online use the java route. I don't know, I think this will work. I'm not really sure what's going on. Anyway, I'm going to have to figure out what jRuby is all about, but that doesn't look too hard.
%%%%%
Bingo. Downloading from the site made everything better. One day I'm going to be a Linux baller and just figure this stuff out in like a minute or something.
%%%%%
I have 300 images. Each image has 300 features. Each feature is a 132-tuple.
I can't handle all of this information at once. I can't reduce the number of images. Thus, I must reduce the number of features. I can do the following: (1) feature subset selection (3) discrete wavelet transform (2) principal component analysis. I might do some sort of tree grouping thing like DIANA or something, but I can't remember where that is in the book.
%%%%%
Attribute selection in Weka is in the "Filter" button. Here is a good site to start with.
%%%%%
I did the attribute selection on one of my arff files that contained the 300 keypoints for an image, and it returned the 7 best attributes - which corresponded to the columns. Basically, the 7 best dimensions for each keypoint, not the 7 best keypoints for the whole image. The solution: transpose the arff file so that the keypoints are the attributes listed (@attr... k1, k2, k3,...,k300), and the instances are the features of each keypoint.
%%%%%
I think I'm going to use Java to process the images for key features. This site has some Java/Weka codes and applets, and miscellaneous machine learning data sets. Here is a page from the Weka site concerned with using Jython with Weka. This page talks about calling the Weka API from Matlab. Apparently Matlab is built up from the JVM, I had no idea.
%%%%%
I've tried all day to run use Weka in an automated fashion. I'm going to try using it from Matlab, and then I'm going to just do it by... by hand. I had a the jruby.jar and weka.jar file in the directory, and some APIs just wouldn't work. I got some kind of exception like this:
Exception in thread "main" java.lang.NoClassDefFoundError: weka/filters/supervised/attribute/AttributeSelection
Caused by: java.lang.ClassNotFoundException: weka.filters.supervised.attribute.AttributeSelection
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: weka.filters.supervised.attribute.AttributeSelection. Program will exit.
I don't know what any of that means... it looks like it can't find the classes I need? I don't know. I ran the kmeans script from Scientifice Computing with Ruby, but I couldn't figure out how to adapt that to attribute selection, or even filtering.
I'm going to spend the rest of the night (a) writing a filtering script (b) mining all of my 300 classes by hand. Fortunately I have plenty of Diet Coke.
%%%%%
The other group got awesome results by averaging all of their descriptor vectors into one vector per image? Did I hear that right? What the fuck?
%%%%%
Okay, I found this site that has a bunch of Weka links including manuals and powerpoints. I think I finished scripting everything. I think that all we have to do now is figure out how to use weka effectively.
%%%%%
Here's a page that shows you how to use Weka in your Java code.
%%%%%
I was having a lot of trouble with exceptions in the Java code I used in the above website. Also, apparently in JRuby arrays come in two flavors: Ruby, and Java. I needed to pass a Java String[] array to a Weka API thingy, but I couldn't figure out how to declare a strictly Java array as opposed to a Ruby array. Eventually I found this wonderful site, the JRuby wiki. I don't know how I didn't find it earlier. Anyway, to Javafy something in JRuby, just do thing.to_java.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment