CONFUSION256
usage: conf= confusion256(guess, truth, ncat);
Generates the confusion matrix from a set of classification
guesses, compared to the actual ground truth
guess : what we think the class assignments should be
truth : what the class assignments actually are
These are two vectors of integers, typically 1 thu 256 in value.
They must be the same length (every ground truth must have a
corresponding guess). They must start at 1.
ncat : (optional) size of confusion matrix
[ default; max(truth) ]
example: confusion([1:4 4:-1:1], [1:4 1:4] )
ans =
1/2 0 0 1/2
0 1/2 1/2 0
0 1/2 1/2 0
1/2 0 0 1/2
FEATURES256
Load a set of images and reduce them to feature
vectors which you can train/test on.
usage: x= features256(files, func, ...)
files: list of files
func : function which takes an image and returns
a feature vector
... : additional arguments to func
x : nxm matrix where n is the number of files
and m is the length of the feature vector
example: [ftrain,ftest]= impick256(imcats256(1:256),10,10)
xtrain= features256(ftrain, 'regularizer', 8);
xtest = features256(ftest , 'regularizer', 8);
In this case the function REGULARIZER takes each image, subtracts
the mean, normalizes so that the standard deviation is 1, then reduces
the size to 8x8. Thus the above matrices xtrain and xtest will be
of size 2560x64.
see also: REGULARIZER
GROUNDTRUTH256
Return groundtruth classifications for a set of Caltech-256 files
as generated by IMPICK256
usage: [gtrain,gtest]= groundtruth256(ntrain, ntest, ncat);
ntrain : training images per category [default: as many as possible]
ntest : test images per category [default: 80-ntrain]
ncat : number of categories, or else a list of categories
[ default = 256 ]
example:
cd ~/256/images
[ntrain,ntest,ncat]= deal(10,25,256);
[ftrain,ftest]= impick256(imcats256(1:ncat),ntrain,ntest);
[gtrain,gtest]= groundtruth256(ntrain, ntest, ncat);
IMCATS256
Get a list of all image categories in the current directory
usage: categories=imcats256(indices,rootpath);
indices : optional list of category numbers
rootpath : optional root directory [default= "."]
example: categories= imcats(
IMNAME256
Generate a list of file names from a given list
of category/file number pairs. This is just a
shorthand way of getting the names of the Caltech-256
image you want.
usage: filename = imname256(ncat , nima)
filenames = imname256(ncats, nimas)
filename : string of file's full name
filenames : cell of strings
ncat , nima : category and file number
ncats, nimas : array or cell of numbers
example: imname256(24,8)
IMPICK256
Pick ntrain and ntest images from each of the specified categories
(making sure these two sets are disjoint).
usage: [ftrain,ftest]=impick256(categories,ntrain,ntest)
categories: cell containing all desired category names
ntrain : training images per category [default: as many as possible]
ntest : test images per category [default: 80-ntrain]
ftrain : cell of training image names
ftest : cell of test image names
example: [ftrain,ftest]= impick256(imcats256,50,30,4);
IMREAD256
Read one or more images from a given set of filenames,
and convert them to grayscale. There are two different
ways to specify images: by filename or by category/image
numbers.
usage: [ima,map]= imread256(filename);
[ima,map]= imread256(ncat,nimage);
example: There are two ways to read the 8th images in the
24th category:
ima= imread('024.butterfly/024_0008.jpg');
ima= imread256(24,8));
If argument(s) are of type matrix or cell, IMREAD256 reads
multiple files and outputs them as cells.
example: If you want the first 8 butterfly images say either
ima= imread256(24,1:8);
or else use an explicit list of filenames
filenames= imname256(24,1:8);
ima= imread256(filenames);
see also IMNAME256
MOSAIC256
Plot one or more images in a single window. You may
supply either the image matrices or just the image
names (in which case it will find and load the matrices).
usage: mosaic256(images);
mosaic256(images, rows);
mosaic256(images, rows, cols);
mosaic256(images, rows, cols, ...)
images : this may be any of the following:
a single filename (string)
a cell of multiple filenames
a single image (matrix)
a cell of multiple images
rows : (OPTIONAL) how many rows of images
cols : (OPTIONAL) how many columns of images
You may also supply these parameter/value pairs
Parameter Default Description
--------- -------- -------------------------------
page 1 show a different page of images
aspect false use true aspect ratios?
labels true label images?
sideways true draw category names sideways?
rescale 1.1 resize images
If you don't supply rows and/or cols it will guess.
PARSE256
A routine to simplify arguments parsed by the various 256 functions.
usage: vals= parse256(val1,val2,...,Property1,Value1,Property2,Value2,...);
Store any initial numeric values in the output cell VALS, then assign
the remaining properties to variables of the same name within the
caller.
example: vals= parse256(1,8.7,12,'length',10,'Width',20);
At this point vals= {1,8.7,12}, length=10 and width=20 in the current
workspace. Note that property names are case insensitive.
see also ASSIGNIN
RAND256
Initialize the random number generator with a user-supplied seed.
usage: seed=rand256(seed)
If there is no seed or the seed is negative, the seed is chosen
based on the current clock value.
REGULARIZER
Apply and offset and scale such that the image mean is zero
and the image standard deviation is 1. Then fit each image
to the same canonical size (default: 64x64).
usage: im2= regularizer(im1, n);
im1: input image (black and white, probably uint8)
im2: output image (single-precision)
n : width/height of output image
[ default = 64 ]
RUN256
An example of how to generate final confusion matrices for the given
values of ntrain, ntest and random number seeds.
usage: [perfs,confs,guesses,truths]=run256(stages,ntrain,ntest,seeds,func,...);
STRVIEW
usage: strview(strcell,cols,width)
Output a cell of strings to the terminal.
Optionally show strings in multiple columns
with specified column width.