1 Star 0 Fork 1

武星晔 / BPL

forked from james / BPL 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

BPL model for one-shot learning

Matlab source code for one-shot learning of handwritten characters with Bayesian Program Learning (BPL).

Citing this code

Please cite the following paper:

Lake, Brenden M., Salakhutdinov, Ruslan, and Tenenbaum, Joshua B. (in press). Human-level concept learning through probabilistic program induction. Science.

Pre-requisites

The Lightspeed Matlab toolbox
(http://research.microsoft.com/en-us/um/people/minka/software/lightspeed/)
Please install and add the lightspeed functions to your Matlab path.

The Omniglot data set
(https://github.com/brendenlake/omniglot)
Place these two Omniglot files in the 'data/' directory:
matlab/data_background.mat
matlab/data_evaluation.mat

Using the code

Setting your path
First, you must add all of the sub-directories to your Matlab path. While in the main BPL directory type this command:

addpath(genpath('.'));

Pre-processing stroke data
This only needs to be run once. From the 'data' directory, run:

omniglot_preprocess;

This will create the 'data_background_processed.mat' and the 'data_evaluation_processed.mat' files for accessing the Omniglot dataset with pre-processed stroke data.

Parsing demo
To run the model fitting demo, type

demo_fit;

One-shot classification
First, download the pre-computed models and unzip such that 'model_fits' and 'model_refits' are sub-directories of the 'classification' directory.
http://cims.nyu.edu/~brenden/supplemental/BPL_precomputed/model_fits.zip
http://cims.nyu.edu/~brenden/supplemental/BPL_precomputed/model_refits.zip

To run the model re-fitting demo, enter the 'classification' directory and type:

demo_refit;

To measure classification error rate with the pre-computed results, type:

run_classification;

One-shot exemplar generation

First, enter the 'generate_exemplars' directory and unzip 'model_fits.zip' so 'model_fits' is now a sub-directory. These are the pre-computed models that were used in the exemplar generation visual Turing tests.

To run the exemplar generation demo, from within the 'generate_exemplars' directory type:

demo_generate_exemplar;

Computing resources

Most experiments will require a multi-CPU cluster to run in a reasonable amount of time. Fitting motor programs to images of characters can be run in parallel.

The parsing and one-shot classification demos include a 'fast_mode' option (on by default) which allows for the demo to run quickly, skipping the expensive procedure of fitting the strokes to the details of the image. Use this mode with caution, as this mode is much cruder and was not used in the paper results.

Compatibility

Code was developed as tested on MATLAB R2013a and Lightspeed toolbox version 2.6.

The MIT License (MIT) Copyright (c) 2015 Brenden Lake Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Bayesian Program Learning model for one-shot learning 展开 收起
Matlab
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Matlab
1
https://gitee.com/first_Learning/BPL.git
git@gitee.com:first_Learning/BPL.git
first_Learning
BPL
BPL
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891