{"id":15646343,"url":"https://github.com/csukuangfj/opencnn","last_synced_at":"2025-04-30T12:04:55.531Z","repository":{"id":103069123,"uuid":"158999188","full_name":"csukuangfj/OpenCNN","owner":"csukuangfj","description":"An Open Convolutional Neural Network Framework in C++ From Scratch","archived":false,"fork":false,"pushed_at":"2021-03-13T07:03:07.000Z","size":720,"stargazers_count":59,"open_issues_count":1,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-13T07:03:56.400Z","etag":null,"topics":["cnn","deep-learning","neural-networks-from-scratch","opencnn"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csukuangfj.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-25T04:56:50.000Z","updated_at":"2024-10-18T04:28:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"43d3c24f-8207-4c54-ab4a-303d4eccb076","html_url":"https://github.com/csukuangfj/OpenCNN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csukuangfj%2FOpenCNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csukuangfj%2FOpenCNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csukuangfj%2FOpenCNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csukuangfj%2FOpenCNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csukuangfj","download_url":"https://codeload.github.com/csukuangfj/OpenCNN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231299729,"owners_count":18354982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cnn","deep-learning","neural-networks-from-scratch","opencnn"],"created_at":"2024-10-03T12:12:30.618Z","updated_at":"2024-12-26T01:27:42.106Z","avatar_url":"https://github.com/csukuangfj.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Build Status](https://travis-ci.com/csukuangfj/OpenCNN.svg?branch=dev)](https://travis-ci.com/csukuangfj/OpenCNN)\n\n\n*I am trying to port to [Bazel][10] and adding more documentation. It may break some\nof the existing functionalities; but it should be stable in three weeks*.\n\n[Documentation][9]\n\n# OpenCNN\n\nOpenCNN is a convolutional neural network framework implemented\nwith C++11 from scratch.\n\n## Table of contents\n\n- [Features](#features)\n- [Supported Layers](#supported-layers)\n- [Build](#build)\n- [Example with MNIST](#example-with-mnist)\n- [Usage](#usage)\n- [TODO](#todo)\n- [License](#License)\n\n## Features\n- Easy to understand\n    * Simply implemented and a good source for learning CNN\n- Easy to extend\n    * Well defined interface for adding new layer types\n- Few dependencies\n    * Depends only on [protobuf][1], [glog][2] and [gflags][3]\n- Fully tested\n    * Every layer is covered by unit test with [googletest][4]\n    * [autodiff][5] (in forward mode) is implemented to verify the correctness of forward/backward propagation\n- Pure C++\n    * If you are a big fan of C++\n- Runs on CPU\n    * No GPU is needed.\n    * 95.21% accuracy on MNIST test dataset in 5000 iterations with a batch size of 16\n\n## Supported Layers\n- convolutional\n- batch normalization\n- ReLU\n- leaky ReLU\n- max pooling\n- full connected\n- dropout\n- softmax\n- cross entropy loss (i.e., negative log loss)\n- softmax with cross entropy loss\n- L2 loss\n\n## Build\n### Install Dependencies on Linux (Ubuntu)\n\n```sh\nsudo apt-get install libprotobuf-dev protobuf-compiler libgflags-dev libgoogle-glog-dev\n```\n\n### Install Dependencies on Mac OS X\n\n```\nbrew install gflags glog protobuf\n```\n\n### Compile From Source\n\n```sh\ngit clone https://github.com/csukuangfj/OpenCNN.git\ncd OpenCNN\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n### Run Unit Test\n\n```sh\ncd OpenCNN/build\n./gtest\n```\n\nIt should pass all the test cases on your system.\n\n## Example with MNIST\nWe use the following network architecture for MNIST:\n\n| Layers                | Description                      |\n|-----------------------|----------------------------------|\n| Input                 | dim: 1x28x28                     |\n| Convolution-1         | num_output: 32, kernel_size: 3x3 |\n| Batch normalization-1 |                                  |\n| ReLU-1                |                                  |\n| Convolution-2         | num_output: 32, kernel_size: 3x3 |\n| Batch normalization-2 |                                  |\n| ReLU-2                |                                  |\n| Max pooling-1         | win_size: 2x2, stride: 2x2       |\n| Convolution-3         | num_output:64, kernel_size: 3x3  |\n| Batch normalization-3 |                                  |\n| ReLU-3                |                                  |\n| Convolution-4         | num_output: 64, kernel_size: 3x3 |\n| Batch normalization-4 |                                  |\n| ReLU-4                |                                  |\n| Max pooling-2         | win_size: 2x2, stride: 2x2       |\n| Full connected-1      | num_output: 512                  |\n| Batch normalization-5 |                                  |\n| ReLU-5                |                                  |\n| Dropout-1             | keep_prob: 0.8                   |\n| Full connected-2      | num_output: 10                   |\n| Softmax with log loss |                                  |\n\nDuring the training a batch size of 16 is used and the accuracy\nreaches 95.21% after 5000 iterations. The results for training loss and\ntest accuracy are plotted in the following figure:\n\n![training-loss-test-accuracy-versus-iterations][6]\n\nA pretrained model taken after 20000 iterations achieving an accuracy\nof 96.74% is provided in [OpenCNN-Models][8].\n\n## Usage\nPlease refer to [examples/mnist][7] for how to use OpenCNN.\n\nMore tutorials will be provided later.\n\n## TODO\n- [ ] Add advanced optimizers\n- [ ] Add more layer types\n- [ ] Make code run faster\n- [ ] Tutorials and documentation\n\n\n## License\n\n\n[10]: https://bazel.build/\n[9]: https://csukuangfj.github.io/doc/OpenCNN/\n[8]: https://github.com/csukuangfj/OpenCNN-Models/tree/master/mnist\n[7]: https://github.com/csukuangfj/OpenCNN/tree/master/examples/mnist\n[6]: /examples/mnist/loss-accuracy-iter.png\n[5]: https://en.wikipedia.org/wiki/Automatic_differentiation\n[4]: https://github.com/abseil/googletest\n[3]: https://github.com/gflags/gflags\n[2]: https://github.com/google/glog\n[1]: https://github.com/protocolbuffers/protobuf\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsukuangfj%2Fopencnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsukuangfj%2Fopencnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsukuangfj%2Fopencnn/lists"}