{"id":20439558,"url":"https://github.com/josstorer/nn_example","last_synced_at":"2025-07-02T07:32:27.444Z","repository":{"id":86365816,"uuid":"550742798","full_name":"josStorer/nn_example","owner":"josStorer","description":"This repository is related to a video about principles of neural networks, which demonstrates how to write a simple neural network in 100 lines of code and implement handwritten digit recognition without using a framework.  这是一个与神经网络原理讲解视频, 相配套的项目, 演示在不使用框架的情况下, 用约100行代码编写简易的神经网络, 并借此实现手写数字识别.","archived":false,"fork":false,"pushed_at":"2023-02-07T13:23:11.000Z","size":393,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T22:42:20.347Z","etag":null,"topics":["deep-learning","machine-learning","neural-network"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josStorer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2022-10-13T08:55:15.000Z","updated_at":"2023-06-03T07:07:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"f59ed1b4-70da-4560-b765-b0694573df17","html_url":"https://github.com/josStorer/nn_example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/josStorer/nn_example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josStorer%2Fnn_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josStorer%2Fnn_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josStorer%2Fnn_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josStorer%2Fnn_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josStorer","download_url":"https://codeload.github.com/josStorer/nn_example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josStorer%2Fnn_example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263093775,"owners_count":23412879,"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":["deep-learning","machine-learning","neural-network"],"created_at":"2024-11-15T09:18:04.224Z","updated_at":"2025-07-02T07:32:27.432Z","avatar_url":"https://github.com/josStorer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **[简体中文](./README_ZH.md) | English**\n\nThis repository is related to the [video about principles of neural networks](https://www.bilibili.com/video/BV1fd4y1y7xS/?p=2), which demonstrates how to write a simple neural network and implement handwritten digit recognition without using a framework.\n\nThe neural network has a single hidden layer, and one output, you can change some arguments in the [config file](./usps/config.py) to adjust the settings for model training/simplification/preview detection\n\n## Start\n\n```shell\ngit clone https://github.com/josStorer/nn_example.git --depth=1\ncd nn_example\npip install -r requirements.txt\npython cli.py -h\n````\n\n## Command example\n\n```shell\npython cli.py -h                 # get help\npython cli.py -test              # test accuracy\npython cli.py -m                 # mini example test\npython cli.py -train             # start training the model\npython cli.py -s                 # simplify trained weights\npython cli.py -p                 # start the real-time preview detection, open img.jpg in usps folder with a paint software, then edit and save, the result will be automatically refreshed\npython cli.py -p -pycharm        # pycharm preview mode, automatically refresh with SciView. When \"right-click\" running ./usps/realtime_predict.py in pycharm, this mode is True\npython cli.py -p -pf [filename]  # specify the image filename of the real-time preview\n````\n\n***\n\n### Notes\n\nThe number of classes can be modified in config.py, and the data source and data annotation can be modified in train.py\n\nThe data label value starts from 1, indicating category 1, 2, 3, ... 99, 100 ...\n\nFinally, networks with the number of [class_num] are generated, each of which is used to predict whether the given data is of category 1, 2, 3, ... 99, 100 ...\n\nWhen implementing classification, the network index with the prediction result closest to 1 is the currently judged category. The implementation code is as follows:\n\n````python\nresults = np.zeros(config.class_num)\nfor i in range(config.class_num):\n    results[i] = network[i].predict(data)\nreturn results.argmax() # This result starts from 0, so you have to add 1 to get the above category labelled value\n````\n\n***\nreference: https://victorzhou.com/blog/intro-to-neural-networks/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosstorer%2Fnn_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosstorer%2Fnn_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosstorer%2Fnn_example/lists"}