项目作者: mauri870

项目描述 :
MNIST trained in php
高级语言: PHP
项目地址: git://github.com/mauri870/php-fann-mnist.git
创建时间: 2017-03-27T23:49:21Z
项目社区:https://github.com/mauri870/php-fann-mnist

开源协议:

下载


PHP MNIST

In this project i’m using the php fann connector for the FANN library
to develop an OCR based on the MNIST dataset.

Installation

  1. sudo apt install libfann-dev libfann2
  2. pecl install fann # get the dll here http://pecl.php.net/package/fann if you are using windows
  3. git clone https://github.com/mauri870/php-fann-mnist
  4. cd php-fann-mnist

You can also use a docker container to try the project:

  1. docker run -it php:latest bash

Usage

Download the dataset and generate FANN files

First you need to download the mnist dataset, for that run the following commands:

  1. mkdir -p data
  2. NAMES="train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte"
  3. for n in $NAMES; do
  4. echo "Downloading $n..."
  5. wget -qO- http://yann.lecun.com/exdb/mnist/$n.gz | gunzip -c > data/$n
  6. done

Next generate the train/test and validation files for FANN

  1. php preprocess.php

Train

  1. php train.php

Since FANN rely only on cpu computations, you can expect a training time of ~40 minutes on an octa core processor

Test

  1. php test.php