{ "info": { "author": "Makoto Shimazu", "author_email": "shimazu@google.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Environment :: No Input/Output (Daemon)", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "Gboard Physical Handwriting Version\n===================================\n\nGboard Physical Handwriting Version is a device which translates your\nscribble on your keyboard into a character. You can make your own Gboard\nPhysical Handwriting Version by printing your own printed circuit board\n(PCB). Also, you can train your own model to recognize a customized set\nof characters. This repository provides circuit diagram, the board\nlayout and software to recognize your stroke over the keyboard as a\ncharacter.\n\nSoftware Usage\n--------------\n\nInput Characters\n~~~~~~~~~~~~~~~~\n\n.. code:: shell\n\n $ pip install .\n $ nazoru-input\n\nBy running the commands above, you can make your own machine into an\ninput device which accepts scribbles on the connected keyboard and send\ncharacters via bluetooth. At the beginning, this script scans\nconnected keyboards and starts listening to inputs from one of the\nkeyboards. Then it translates a sequence of keydowns into a predicted\ncharacter considering pressed timings, and send the character to the\ntarget device paired by bluetooth.\n\nIf you want to try it for development, you can use ``-e`` option.\n\n.. code:: shell\n\n $ pip install -e .\n $ nazoru-input\n\nTraining Model\n~~~~~~~~~~~~~~\n\n.. code:: shell\n\n $ pip install .\n $ nazoru-training ./data/strokes.zip\n\nWe have a script to generate a trained model which recognizes input\ncharacters from scribbles. This script renders input stroke data into\nimages to extract useful features for prediction considering position of\nthe key and timing of keyboard events. Rendered images are fed into the\nneural network model and the optimizer tunes the model to fit the data.\nOnce the training is done, the script outputs the trained graph, which\nyou can use for your own device. In the case where you install\n``nazoru-training`` from pip, you can find ``strokes.zip`` at here:\nhttps://github.com/google/mozc-devices/mozc-nazoru/data/strokes.zip\n\nYou can change some configurations by passing command line flags (e.g.\npath to the input/output files, hyper-parameters). Run\n``nazoru-training --help`` for details.\n\nHardware Setup\n--------------\n\nPrinted Circuit Board\n~~~~~~~~~~~~~~~~~~~~~\nGboard Physical Handwriting Version uses Raspberry Pi Zero for the\nkeyboard input recognition and RN42 module for Bluetooth connection to\nyour laptop. You can check the wiring at ``board/schematic.png``. Also,\nthe original CAD data in EAGLE format is available\n(``board/nazoru-stack.sch`` and ``board/nazoru-stack.brd``). The board\nhas non-connected pads and connectors for SPI and I2C. The connector\nitself should be compatible with other Raspberry Pi, but we tested it\nonly on Raspberry Pi Zero W.\n\n.. image:: https://raw.githubusercontent.com/google/mozc-devices/master/mozc-nazoru/board/schematic.png\n :width: 1000px\n\nRaspberry Pi Setup\n~~~~~~~~~~~~~~~~~~\n\n**Step 0 - Prepare your Raspberry Pi**\n\n Please prepare your Raspberry Pi, SD card initialized by RASPBIAN\n image, and RN42 module. Connect your Raspberry Pi with RN42 as the\n schematic shows. Please make sure you can have access to the internet\n and also it has enough disk space to install packages on the following\n steps.\n\n**Step 1 - Setup UART to RN42**\n\n If you try it on Raspberry Pi Zero W or Raspberry Pi 3, you need to\n have additional settings for the serial communication because they\n equipped a wireless module connected by the UART. See details at `an\n official document\n `_.\n In short, you need to add ``enable_uart=1`` to ``/boot/config.txt`` on\n your Raspberry Pi.\n\n**Step 2 - Initial setup for RN42**\n\n You need to write your initial setup to RN42. At first, install screen\n and open ``/dev/serial0`` for configuration.\n\n .. code:: shell\n\n $ sudo apt install screen\n $ sudo screen /dev/serial0 115200\n\n After that, please type the following commands. Note that you need to\n type ENTER after input commands. For example, please type ``$$$``\n and ENTER to execute ``$$$`` command.\n\n 1. ``$$$`` : Get into the command mode. The green LED will blink\n faster.\n 2. ``+`` : You can see what you type.\n 3. ``SD,0540`` : Set the device class to keyboard.\n 4. ``S~,6`` : Set the profile to HID.\n 5. ``SH,0200`` : Set the HID flag to keyboard.\n 6. ``SN,nazoru-input`` : Set the device name as nazoru-input. You\n can name it as you want.\n 7. ``R,1`` : Reboot RN42.\n\n You can quit the screen by ``C-a k``.\n\n**Step 3 - Download and install nazoru-input**\n\n We provide a service file at ``data/nazoru.service`` to launch\n ``nazoru-input`` when booting. You can install it by uncomment\n ``data_files`` entry in ``setup.py``. Also, before installing this\n package, We'd strongly recommend you to install some package from apt\n repository as follows, so that you can install pre-built packages.\n\n .. code:: shell\n\n $ sudo apt install git python-pip python-numpy python-cairocffi \\\n python-h5py python-imaging python-scipy libblas-dev liblapack-dev \\\n python-dev libatlas-base-dev gfortran python-setuptools \\\n python-html5lib\n $ sudo pip install http://ci.tensorflow.org/view/Nightly/job/nightly-pi-zero/219/artifact/output-artifacts/tensorflow-1.6.0-cp27-none-any.whl\n $ git clone https://github.com/google/mozc-devices\n $ cd mozc-devices/mozc-nazoru\n $ sudo pip install . # If you want to develop nazoru-input, please use 'pip install -e .' instead.\n\n**Step 4 - Enjoy!**\n\n .. code:: shell\n\n $ sudo nazoru-input # If you miss sudo, nazoru-input may use a DummyBluetooth object.\n\nTraining Data Format\n--------------------\n\nWe are providing the raw training data at ``data/strokes.zip``. Once you\nuncompress the zip file, you will get a ``.ndjson`` file which contains\nall entries (we call them **strokes**) we have used for training.\n\nEach stroke entry contains the following field:\n\n+----------+-----------+-------------------------------------------+\n| Key | Type | Description |\n+==========+===========+===========================================+\n| id | integer | A unique identifier across all strokes. |\n+----------+-----------+-------------------------------------------+\n| writer | string | A unique identifier of writer. |\n+----------+-----------+-------------------------------------------+\n| kana | string | Label of the character drawn. |\n+----------+-----------+-------------------------------------------+\n| events | list | List of keyboard events. |\n+----------+-----------+-------------------------------------------+\n\nEach event is a 3-tuple of (``key``, ``event type``, ``time``). ``key``\ndescribes the key on which the event happened. ``event type`` describes\nwhat type of event happened. It should be \"down\" (keydown) or \"up\"\n(keyup). ``time`` describes the consumed time until the event is fired\nin millisecond.\n\nFor example, the entry below denotes a stoke of \"\u307b\n(\\\\u307b)\" accompanied with a sequence of keyboard events\nstarting from the keydown event on \"t\" and ending at the keyup event on\n\"l\" which was fired 1.005 seconds later after it started recording.\n\n.. code:: json\n\n {\n \"id\": 5788999721418752,\n \"writer\": \"ffb0dac6b8be3faa81da320e29a2ba72\",\n \"kana\": \"\\u307b\",\n \"events\": [\n [\"t\", \"down\", 0],\n [\"g\", \"down\", 40],\n ...\n [\"l\", \"down\", 966],\n [\"l\", \"up\", 1005]\n ]\n }\n\nYou can also prepare your own dataset in ``.ndjson`` format and rebuild\nthe model on it. The list of kanas to recognize is in\n``src/nazoru/lib.py``. You can update that if you want to modify the set\nof characters.\n\nNetwork Structure\n-----------------\n\nData Preprocessing\n~~~~~~~~~~~~~~~~~~\n\nEach stroke entry is rendered to a square image before any training\nruns. The script (``nazoru-training``) renders strokes in various ways\nto extract useful features. Our default settings extract 10 features\nfrom each stroke entry: 8 directional features and 2 temporal features\non 16x16 square canvas; this means that the input shape is 16x16x10 by\ndefault.\n\nConvolutional Network\n~~~~~~~~~~~~~~~~~~~~~\n\nRendered inputs are fed into a convolutional neural network designed for\nthis task. Body structure looks like:\n\n- Convolutional layer (kernel size: 3x3, filter size: 32, stride: 2,\n activation: Relu)\n- Separatable convolutional layer (kernel size: 3x3, filter size: 64,\n stride: 1, activation: Relu)\n- Separatable convolutional layer (kernel size: 3x3, filter size: 128,\n stride: 2, activation: Relu)\n- Separatable convolutional layer (kernel size: 3x3, filter size: 128,\n stride: 1, activation: Relu)\n\nFor more details about the separatable convolutional layers, please\nrefer to `MobileNet `__ architecture.\n\nAuthors\n-------\n\nMachine Learning:\n\n Shuhei Iitsuka \n\nHardwares, system setups:\n\n Makoto Shimazu \n\nLicense\n-------\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may\nnot use this file except in compliance with the License. You may obtain\na copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://landing.google.com/tegaki", "keywords": "", "license": "Apache", "maintainer": "", "maintainer_email": "", "name": "nazoru-input", "package_url": "https://pypi.org/project/nazoru-input/", "platform": "", "project_url": "https://pypi.org/project/nazoru-input/", "project_urls": { "Homepage": "https://landing.google.com/tegaki" }, "release_url": "https://pypi.org/project/nazoru-input/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Package for Gboard Physical Handwriting Version", "version": "0.1.1" }, "last_serial": 3723130, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "fc6865a85dff7076dab36d53c4a2b3c0", "sha256": "48cd812c63ae8b825b1c87ecd012ef8c7abb9853d9d4fc7f1e626228e8545691" }, "downloads": -1, "filename": "nazoru-input-0.1.tar.gz", "has_sig": false, "md5_digest": "fc6865a85dff7076dab36d53c4a2b3c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 189320, "upload_time": "2018-03-31T15:03:12", "url": "https://files.pythonhosted.org/packages/e0/21/9a71a63c704d0e61c3518cc92ef3d411bb8ec633d62d4e39790f55c44f70/nazoru-input-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "9ff55bf877d91193a44f31df680e74e3", "sha256": "f3990b368e082ba3df3201b646ced38da2d2be495db23e2bd0b14d5ea421c23b" }, "downloads": -1, "filename": "nazoru-input-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9ff55bf877d91193a44f31df680e74e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 189354, "upload_time": "2018-03-31T15:12:53", "url": "https://files.pythonhosted.org/packages/67/23/d7795d5caa4840bda066f7832366bdad1ee8a2b574e5db25ee10ad4736fa/nazoru-input-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9ff55bf877d91193a44f31df680e74e3", "sha256": "f3990b368e082ba3df3201b646ced38da2d2be495db23e2bd0b14d5ea421c23b" }, "downloads": -1, "filename": "nazoru-input-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9ff55bf877d91193a44f31df680e74e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 189354, "upload_time": "2018-03-31T15:12:53", "url": "https://files.pythonhosted.org/packages/67/23/d7795d5caa4840bda066f7832366bdad1ee8a2b574e5db25ee10ad4736fa/nazoru-input-0.1.1.tar.gz" } ] }