{"id":22372415,"url":"https://github.com/1chooo/cnn-handwriting-detection","last_synced_at":"2025-07-30T21:32:04.033Z","repository":{"id":37704463,"uuid":"502085220","full_name":"1chooo/CNN-handwriting-detection","owner":"1chooo","description":"A CNN-driven method for detecting and classifying handwriting.","archived":true,"fork":false,"pushed_at":"2024-04-28T11:57:52.000Z","size":7637,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T17:18:21.685Z","etag":null,"topics":["cnn","deep-learning","keras","python3","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1chooo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-06-10T15:05:13.000Z","updated_at":"2024-06-30T08:14:41.000Z","dependencies_parsed_at":"2023-01-19T13:15:55.828Z","dependency_job_id":"5748d38f-ffcc-4e7e-a06e-587d5f1f885b","html_url":"https://github.com/1chooo/CNN-handwriting-detection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/1chooo/CNN-handwriting-detection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1chooo%2FCNN-handwriting-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1chooo%2FCNN-handwriting-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1chooo%2FCNN-handwriting-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1chooo%2FCNN-handwriting-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1chooo","download_url":"https://codeload.github.com/1chooo/CNN-handwriting-detection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1chooo%2FCNN-handwriting-detection/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267945032,"owners_count":24170214,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","keras","python3","tensorflow"],"created_at":"2024-12-04T20:38:35.647Z","updated_at":"2025-07-30T21:32:03.099Z","avatar_url":"https://github.com/1chooo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CNN-based Handwriting Detection and Classification\n\n[![project badge](https://img.shields.io/badge/1chooo-CNN__Handwriting__Dection-informational?style=for-the-badge)](https://github.com/1chooo/CNN-handwriting-dection)\n[![License](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](./LICENSE \"Go to license section\")\n[![Made with Python](https://img.shields.io/pypi/pyversions/tensorflow.svg?color=blue\u0026style=for-the-badge)](https://python.org \"Go to Python homepage\")\n\n[![conda version](https://img.shields.io/badge/conda-342B029.svg?\u0026style=for-the-badge\u0026logo=anaconda\u0026logoColor=white)](https://docs.conda.io/en/latest/#)\n[![conda version](https://img.shields.io/badge/TensorFlow-FF6F00?style=for-the-badge\u0026logo=tensorflow\u0026logoColor=white)](https://www.tensorflow.org/)\n[![conda version](https://img.shields.io/badge/Keras-FF0000?style=for-the-badge\u0026logo=keras\u0026logoColor=white)](https://keras.io/)\n\n## A brief summary of the project\nAuthor : Hugo ChunHo Lin (1chooo)  \n\nCreated time: 2022/06/22  \n\nIt is the final project of the course: **CE3005-B** in NCU which name of the course is \"Algorithmics\". \n\nThe main goal of this project is to detect the hand writing numbers with the deep learning, **CNN**.\n\n---\n\n## Create Virtual Enviroment\n\n### Build `venv` with `conda`\n\n`conda --version: 4.12.0`\n \n```\n$ conda create --name algML python=3.7\n$ conda install tensorflow=1.15.0\n$ conda install keras=2.3.1\n$ conda install matplotlib\n```\n\nYou guys can also check more details about the virtual environment in the `requirements.txt` and `env.yml`\n\n### Build `venv` with `virtualenv`\n\nPython version `python3.10` with `tensorflow, keras, numpy, matplotlib, pandas`\n\n#### Build `venv` for **MacOS**\n```shell\n$ pip3 install virtualenv\n$ python3.10 -m venv venv\n$ source venv/bin/activate\n$ pip install -r requirements.txt\n$ deactivate\n$ rm -rf venv     # remove the venv\n```\n\n#### Build `venv` for Windows\n```shell\n$ pip install virtualenv\n$ virtualenv venv\n$ venv\\Scripts\\activate\n$ pip install -r requirements.txt\n$ deactivate\n$ rmdir /s venv     # remove the venv\n```\n\n## 中文手寫辨識準確率及損失率\n\n```py\nprint(\"Test loss: \", score[0])\nprint(\"Test accuracy: \", score[1])\n```\n\n| Test Loss | Test Accuracy |\n| :---------: | :-------------: |\n| 0.43642204999923706      | 0.9711764454841614          |\n\n## Processing\n\n```console\nEpoch 1/500\n69/69 [==============================] - 2s 16ms/step - loss: 1.3865 - accuracy: 0.5506 - val_loss: 0.3607 - val_accuracy: 0.8857\nEpoch 2/500\n69/69 [==============================] - 1s 14ms/step - loss: 0.3701 - accuracy: 0.8785 - val_loss: 0.1757 - val_accuracy: 0.9388\nEpoch 3/500\n69/69 [==============================] - 1s 13ms/step - loss: 0.2045 - accuracy: 0.9374 - val_loss: 0.1497 - val_accuracy: 0.9429\n```\n\n## Result\n\n![result](img/results.jpg)\n\n## Reflection on the outcome: \n\n這個專案是我的第一次接觸機器學習的範疇，不得不說對我而言挑戰滿大的，首先的是，要搞清楚四種投影片的內容，不得不說在聽的時候是很傾珮的，還有種原來程式，這樣寫竟然可以做到那麼多事，因為當初的我以為判斷手寫辨識需要非常多程式碼，沒想到是要透過一層層的關係來讓機器回應我們希望他做的事。接著就照自己的吸收狀況來挑選想要使用的演算法，而我挑的是 CNN。\n\n```py\ntrain_history = model.fit(\n    data_train_X, \n    data_train_Y, \n    batch_size=32, \n    epochs=500, \n    verbose=1, \n    validation_split=0.1,\n)\n```\n\n在開始製作時馬上就遇到超級大的瓶頸——讀檔，從來沒有讀過這種一層層架構的檔案，當時真的滿緊張的，畢竟剩下時間不多，對機器學習又有如個新手一般，馬上查了很多文章，還是無法，最後真的好在助教的幫助，在我凌晨還丟問題的時候細心回覆我，才得以讓我繼續向前做這份專案，我想也正是如此才得以在心得上侃侃而談吧～就此我正實做時，發現大多投影上的程式碼，都不太需要做更改，因為我發現改了太多，反而會跟原先演算法設計好的架構越走越遠，於是我在一連串的拼拼湊湊後發現了一個地方，只要花時間精准度就會提高的方法，那就更改以下這個變數宣告裡的`epochs`的次數\n\n```console\nEpoch 1/500\n69/69 [==============================] - 2s 16ms/step - loss: 1.3865 - accuracy: 0.5506 - val_loss: 0.3607 - val_accuracy: 0.8857\nEpoch 2/500\n69/69 [==============================] - 1s 14ms/step - loss: 0.3701 - accuracy: 0.8785 - val_loss: 0.1757 - val_accuracy: 0.9388\nEpoch 3/500\n69/69 [==============================] - 1s 13ms/step - loss: 0.2045 - accuracy: 0.9374 - val_loss: 0.1497 - val_accuracy: 0.9429\n```\n\n精准度也從原先的96廷升到98，不過”val_loss”會大幅提升，因此我也試了把”epochs”的次數調降到比原先高但不會到500的數:200，果然，精准度只降低了一點點，”val_loss”更是大幅度地降低，\n\n```py\nprint(\"Test loss: \", score[0])\nprint(\"Test accuracy: \", score[1])\n```\n\n| Test Loss | Test Accuracy |\n| :---------: | :-------------: |\n| 0.43642204999923706      | 0.9711764454841614          |\n\n不過我想這中間肯定不是只改改這個參數這麼簡單，畢竟 CNN 是層層相依的，不過說實話以我現階段的知識，實在是太脆弱了，不過我相信以這次專案，對我而言機器學習的入門磚，我未來一定可以把這個專案玩得更出色，真的非常慶幸能有這次的體會。\n\n## License\n\nReleased under [MIT](./LICENSE) by [@1chooo](https://github.com/1chooo).\n\n- This software can be modified and reused without restriction.\n- The original license must be included with any copies of this software.\n- If a significant portion of the source code is used, please provide a link back to this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1chooo%2Fcnn-handwriting-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1chooo%2Fcnn-handwriting-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1chooo%2Fcnn-handwriting-detection/lists"}