Giter VIP home page Giter VIP logo

lenet-5's Introduction

LeNet-5神经网络

介绍

根据YANN LECUN的论文《Gradient-based Learning Applied To Document Recognition》设计的LeNet-5神经网络,C语言写成,不依赖任何第三方库。 MNIST手写字符集初代训练识别率97%,多代训练识别率98%。

DEMO

main.c文件为MNIST数据集的识别DEMO,直接编译即可运行,训练集60000张,测试集10000张。

项目环境

该项目为VISUAL STUDIO 2015项目,用VISUAL STUDIO 2015 UPDATE1及以上直接打开即可编译。采用ANSI C编写,因此源码无须修改即可在其它平台上编译。 如果因缺少openmp无法编译,请将lenet.c中的#include<omp.h>和#pragma omp parallel for删除掉即可。

API

#####批量训练 lenet: LeNet5的权值的指针,LeNet5神经网络的核心

inputs: 要训练的多个图片对应unsigned char二维数组的数组,指向的二维数组的batchSize倍大小内存空间指针。在MNIST测试DEMO中二维数组为28x28,每个二维数组数值分别为对应位置图像像素灰度值

resMat:结果向量矩阵

labels:要训练的多个图片分别对应的标签数组。大小为batchSize

batchSize:批量训练输入图像(二维数组)的数量

void TrainBatch(LeNet5 *lenet, image *inputs, const char(*resMat)[OUTPUT],uint8 *labels, int batchSize);

#####单个训练 lenet: LeNet5的权值的指针,LeNet5神经网络的核心

input: 要训练的图片对应二维数组

resMat:结果向量矩阵

label: 要训练的图片对应的标签

void Train(LeNet5 *lenet, image input, const char(*resMat)[OUTPUT],uint8 label);

#####预测 lenet: LeNet5的权值的指针,LeNet5神经网络的核心

input: 输入的图像的数据

labels: 结果向量矩阵指针

count: 结果向量个数

return 返回值为预测的结果

int Predict(LeNet5 *lenet, image input, const char(*labels)[LAYER6], int count);

#####初始化 lenet: LeNet5的权值的指针,LeNet5神经网络的核心

void Initial(LeNet5 *lenet);

lenet-5's People

Contributors

fan-wenjie avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.