纯C深度学习库


纯C深度学习库,采用VS2010编译,里面包含训练数据MNIST,点击就能生成,包括训练和预测,另外送一个C读取图片的文件,有必要自己改写代码
资源截图
代码片段和文件信息
/*
   *This program will open a imageand output to another file
   *Author:hujian in nankai 2016/3/29
*/

#include  
#include 

using namespace std;

#define   __FILENAME  “./img/in.jpg“  //this is the default imageif no input filenamethe image will be used

int main()
{
    //the fp is the file stream of reading data
    //the out is the file stream of writing to file(hex)
    //the dst file is the file stream of dest image
    //
    FILE *fp *out *dstFile;
    //this is the image size
    //we will use fseek and ftell to get the size
    //
    long int size;

    unsigned char ch ch1 ch2;
    //get the higt bites and low bites
    //
    unsigned char high low;
    //this is the image name buffer
    //
    char pic_name[30];
    memset(pic_name 0 sizeof(pic_name));
    //we can input the file‘s nameand the program will open the image and do some
    //oprtationsuch as read datawrite from image data..
    //
//#define INPUT
#ifdef INPUT //if we want to input the filename just define the input.
    printf(“
Please input the image‘s name:“);
    cin >> pic_name;
#else  //okyou don‘t want to input
    strcpy_s(pic_name__FILENAME);
#endif  INPUT
    printf_s(“The filename is:%s
“ pic_name);
    //the follow lines will open the file
    //
    {
        //open the src image for reading the image data
        //
        fopen_s(&fp pic_name “rb“);
        //open the text stream(write)
        //
        fopen_s(&out“res.txt“ “wb+“);
        //open the dest image file stream
        //
        fopen_s(&dstFile“./img/res.jpg“ “wb+“);
        //okcheck the file stream
        //
        {
            if (!fp || !out || !dstFile){
                printf_s(“Can not open the file you inputcheck the filename and re-try
“);
                //exit(EXIT_FAILURE);
            }
        }
    }//end of open filenow we get the file stream done.
    //we want to get the size of the imagewe just use the fseek and ftell get the size
    //
    fseek(fp 0 SEEK_END);
    size = ftell(fp);
    //printf the size
    printf(“get the size is: %d
“ size);
    //rewind means jump to start of the file
    //
    rewind(fp);
    //traversal the image data
    //
    long int i;
    for (i = 0; i    {
        ch = fgetc(fp);
        high = ch >> 4;
        low = ch & 0x0f;
        if (high < 10)
            high += ‘0‘;
        else
            high += 55;
        if (low < 10)
            low += ‘0‘;
        else
            low += 55;
        //write to file stream out
        //
        fputc(high out);
        fputc(low out);
        fputc(‘ ‘ out);
        //16 one line
        //
        if (i % 16 == 0)
            fprintf(out “
“);
    }
    //jump to start of the image file
    //
    rewind(fp);
    bool FormatRight = false;
    for (i = 0; i    {
        ch1 = fgetc(fp);
       

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......       876  2017-04-27 03:40  CNNCNN.sln

    .......      3515  2017-04-27 03:40  CNNCNNCNN.vcxproj

    .......      1493  2017-04-27 03:40  CNNCNNCNN.vcxproj.filters

    .......       143  2017-04-27 03:40  CNNCNNCNN.vcxproj.user

     文件      21411  2018-02-12 14:02  CNNCNNcnn.cpp

    .......      4059  2017-04-27 03:40  CNNCNNcnn.h

     文件       5161  2018-02-12 19:49  CNNCNNmain.cpp

    .......      5817  2017-04-27 03:40  CNNCNNmat.cpp

    .......      1357  2017-04-27 03:40  CNNCNNmat.h

    .......     15592  2017-04-27 03:40  CNNCNNminst.cnn

     文件       4242  2018-02-10 19:41  CNNCNNminst.cpp

    .......       934  2017-04-27 03:40  CNNCNNminst.h

    .......        37  2017-04-27 03:40  CNNCNNMinstReadMe.txt

     文件    7840016  2017-12-24 23:01  CNNCNNMinst est-images.idx3-ubyte

     文件      10008  2017-12-24 23:00  CNNCNNMinst est-labels.idx1-ubyte

     文件   47040016  2017-12-24 23:00  CNNCNNMinst rain-images.idx3-ubyte

     文件      60008  2017-12-24 23:00  CNNCNNMinst rain-labels.idx1-ubyte

     文件       3801  2018-02-12 19:34  CNN
eadImageC.c

     目录          0  2018-02-10 19:37  CNNCNNMinst estImgs

     目录          0  2018-02-12 14:01  CNNCNNPicTransCNNData

     目录          0  2017-04-27 03:40  CNNCNNMinst

     目录          0  2018-02-10 19:38  CNNCNNPicTrans

     目录          0  2017-04-27 03:40  CNNCNN

     目录          0  2017-04-27 03:40  CNN

----------- ---------  ---------- -----  ----

             55018486                    24


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)