{"id":22155931,"url":"https://github.com/citiususc/ho-mnist","last_synced_at":"2025-03-24T14:29:12.155Z","repository":{"id":168593852,"uuid":"623934063","full_name":"citiususc/ho-mnist","owner":"citiususc","description":"Hardware Oriented CNN for MNIST recognition","archived":false,"fork":false,"pushed_at":"2023-04-05T16:25:22.000Z","size":698,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-29T19:23:56.088Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/citiususc.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}},"created_at":"2023-04-05T11:55:34.000Z","updated_at":"2023-04-05T18:08:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"af67308b-d020-400e-b839-50aac8b4ead0","html_url":"https://github.com/citiususc/ho-mnist","commit_stats":null,"previous_names":["citiususc/ho-mnist"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citiususc%2Fho-mnist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citiususc%2Fho-mnist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citiususc%2Fho-mnist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citiususc%2Fho-mnist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/citiususc","download_url":"https://codeload.github.com/citiususc/ho-mnist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245288704,"owners_count":20590946,"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":[],"created_at":"2024-12-02T02:33:19.670Z","updated_at":"2025-03-24T14:29:12.118Z","avatar_url":"https://github.com/citiususc.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HO-MNIST\nHardware Oriented CNN for MNIST recognition.\n\n![HO-MNIST experiment setup](img/setup.jpg)\n\n\n## Online demo\nYou can try an online simulation of our CIM macro! [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/citiususc/ho-mnist/HEAD?labpath=Demo.ipynb) [![Google Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/citiususc/ho-mnist/blob/master/Demo.ipynb) \u003ca href=\"https://github.com/codespaces/new?hide_repo_select=true\u0026ref=main\u0026repo=citiususc/ho-mnist\u0026machine=basicLinux32gb\u0026location=WestEurope\"\u003e\u003cimg src=\"https://github.com/codespaces/badge.svg\" height=\"20\" alt=\"GitHub Codespaces\"\u003e\u003c/a\u003e\n\n\n## Creation of the Hardware Oriented model\n\n### Train model\n```shell\npython3 ./train.py --output-path=./models/mnist_base.pth\n```\n\n### Quantize model\n```shell\npython3 ./quantize.py --model-path=./models/mnist_base.pth --output-path=./models/mnist_quantized.pth\n```\n\n### Convert model to int8 and store scales\n```shell\npython3 ./convert.py --model-path=./models/mnist_quantized.pth --output-path=./models/mnist_quantized_converted.pth\n```\n\n\n## Visualization of the 5-bit kernels\n```shell\npython3 ./display_weights.py --model-path=./models/mnist_quantized_converted.pth --chip-format\n```\n\n\n## Testing of the model\n```shell\npython3 ./test.py --test-base --model-path=./models/mnist_base.pth  # Accuracy: 97.56%\npython3 ./test.py --model-path=./models/mnist_quantized_converted.pth  # Accuracy: 90.57%\npython3 ./test.py --test-hardware --model-path=./models/mnist_hacc --serial-port=/dev/ttyUSB2  # Accuracy: 91.89%\n```\n\n\n## Live demo\n```shell\npython3 ./demo.py --model-path=./models/mnist_quantized_converted.pth --live\npython3 ./demo.py --hardware --model-path=./models/mnist_hacc --serial-port=/dev/ttyUSB2 --live\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitiususc%2Fho-mnist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcitiususc%2Fho-mnist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitiususc%2Fho-mnist/lists"}