**** A Grid Conditional Random Field Toolkit for Matlab *** Jerod Weinman jerod@acm.org 7 May 2009 The GCRF toolkit handles Conditional Random Fields in a grid topology assuming potentials at nodes and edges are the same everywhere in the grid (though vertical and horizontal edge weights may be distinct or tied). The structure of the object-oriented model is as folows. Each @gcrf object stores the weights for its potentials. Data for training and prediction uses an array of general grid graph feature struct with observation features for each node and edge in a specific grid (sizes may be variable). The weights may be learned by several variants of belief propagation. (See examples in the README below.) This code was designed, not to be optimized, but to be correct first, though we may not have succeeded at even that in places. While I am likely unable to provide support, bug reports are welcome, as are small patches for optimizations. Much of the code was written before the author was aware of cellfun or before bsxfun was introduced to Matlab, and these are likely points for useful optimizations. INSTALL # Download gcrf and lbfgs wget http://www.cs.grinnell.edu/~weinman/code/gcrf.tar wget http://www.cs.grinnell.edu/~weinman/code/lbfgs.tar # Make destination and unpack mkdir gcrf tar xf gcrf.tar -C gcrf tar xf lbfgs.tar -C gcrf # Start matlab matlab % Add commands to path >> addpath(genpath('gcrf')) % Read the demo >> edit recognition/gcrf/README.m % Compile a BP accelerator >> cd inference/mex >> mex calcMsgProd.c % Run the demo >> cd recognition/gcrf >> README