public class GistCalculator
{
public static Gist<FImage> fsg = new Gist<FImage>(256, 256);
public static FeatureExtractor<FloatFV, FImage=""> gex = new GistExtractor(fsg);
public static SVMAnnotator svm = new SVMAnnotator(gex);
public static void main(String[] args) throws IOException
{
// load Dataset //
GroupedDataset<String, VFSListDataset<Record<FImage>>, Record<FImage>> allData =
ScenicOrNot.getData(ImageUtilities.FIMAGE_READER);
// group dataset //
GroupedRandomSplitter<String, Record<FImage>> splits = new GroupedRandomSplitter<String, Record<FImage>>(allData, 10, 0, 2);
// run svm //
svm.train(splits.getTrainingDataset());
}
}
I get an error "Data did not contain exactly 2 classes. It had 12."
Does anyone have any samples that might use GIST + SVM? Currently my 12 folders are just that, folders. The names hold no relevance to what is inside (I actually use a RecordReader and extract a float score from a csv file for each image).
Thanks
-scprotz
Last edit: Dave Mobley 2015-09-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your overall approach looks fine - I think the problem lies with your ScenicOrNot class, which I would guess is building a dataset with too many classes (for a binary problem the GroupedDataset should have two just groups).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Last post was actually by me (but forgot to log in-not sure iof I can fix it after the fact)
Hi All,
I have a data set (some thousands of images). I want to run the GIST global descriptor on then and then apply SVM to it.
My basic procedure is:
1) Load dataset (Images are on filesystem in 12 distinct folders)
2) Run SVM (and feature extractor is a GIST extractor I made)
Does this sound like a correct approach? And if so, here is my code so far - any recommendations?
public class GistExtractor implements FeatureExtractor<FloatFV, FImage="">
{
private Gist<FImage> gist = null;
}
public class GistCalculator
{
public static Gist<FImage> fsg = new Gist<FImage>(256, 256);
public static FeatureExtractor<FloatFV, FImage=""> gex = new GistExtractor(fsg);
public static SVMAnnotator svm = new SVMAnnotator(gex);
}
I get an error "Data did not contain exactly 2 classes. It had 12."
Does anyone have any samples that might use GIST + SVM? Currently my 12 folders are just that, folders. The names hold no relevance to what is inside (I actually use a RecordReader and extract a float score from a csv file for each image).
Thanks
-scprotz
Last edit: Dave Mobley 2015-09-07
Your overall approach looks fine - I think the problem lies with your
ScenicOrNot
class, which I would guess is building a dataset with too many classes (for a binary problem theGroupedDataset
should have two just groups).