{"id":19068715,"url":"https://github.com/machine-learning-tokyo/tfjs-workshop","last_synced_at":"2025-04-28T13:40:45.482Z","repository":{"id":96775901,"uuid":"176920508","full_name":"Machine-Learning-Tokyo/tfjs-workshop","owner":"Machine-Learning-Tokyo","description":null,"archived":false,"fork":false,"pushed_at":"2019-04-06T12:03:53.000Z","size":33373,"stargazers_count":29,"open_issues_count":0,"forks_count":30,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-18T16:29:17.481Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/Machine-Learning-Tokyo.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":"2019-03-21T10:16:35.000Z","updated_at":"2024-08-12T19:47:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"d0f5e03d-7b2d-4f82-ab3f-3e3db1e25c97","html_url":"https://github.com/Machine-Learning-Tokyo/tfjs-workshop","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/Machine-Learning-Tokyo%2Ftfjs-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Machine-Learning-Tokyo%2Ftfjs-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Machine-Learning-Tokyo%2Ftfjs-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Machine-Learning-Tokyo%2Ftfjs-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Machine-Learning-Tokyo","download_url":"https://codeload.github.com/Machine-Learning-Tokyo/tfjs-workshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251321182,"owners_count":21570690,"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-11-09T01:11:31.960Z","updated_at":"2025-04-28T13:40:45.474Z","avatar_url":"https://github.com/Machine-Learning-Tokyo.png","language":"JavaScript","readme":"# tfjs-workshop\n\nContains material for a [TensorFlow.js workshop](https://www.meetup.com/Machine-Learning-Tokyo/events/260167619/).\n\nPresentation slides at:\n\nhttps://docs.google.com/presentation/d/1jHkbAQHWIXM7clDwTCzlqPPbnAd4xRoDo34sp6OHe_A/edit?usp=sharing\n\n```\n$ git clone git@github.com:Machine-Learning-Tokyo/tfjs-workshop.git\n```\n\n# Prerequisites\n\n- [git](https://git-scm.com/)\n- [nodejs](https://nodejs.org/en/)\n- [yarn](https://yarnpkg.com/en/)\n\nTo install nodejs, using [nvm](https://github.com/creationix/nvm) is recommended. \n\n# web\n# web-js\n\nThey are simple application of image classification using [MobileNet](https://arxiv.org/abs/1704.04861) which is a light weight model for image classification. \n\n## Step 1. Run demo application with initial model\n\nWeb application demonstrating image classfication using MobileNet. The application classified the given image. The initial model will be downloaded from [TensorFlow Hub](https://tfhub.dev/) that is a registry for publishing pretrained deep learning models. \n\n```\n$ cd web \n# Or\n$ cd web-js\n\n$ yarn\n$ npx parcel src/index.html --open\n```\n\nIt will automatically launch the webapp to classify the given image. Please look into index.html to change the image to be predicted.\nThat application is based on MobileNet demo in [tfjs-models](https://github.com/tensorflow/tfjs-models).\n\n## Step 2. Train your own model in Colab\n\nNow you can your own model in Google Colab with the image you have. Please refer to the instruction in [colab notebook](https://github.com/Machine-Learning-Tokyo/tfjs-workshop/blob/master/colab-notebooks/README.md). You can upload a image as the dataset used for training.\n\n[tfjs-converter](https://github.com/tensorflow/tfjs-converter) is a tool to make a model readable by TensorFlow.js from pre-trained model by TensorFlow. It supports SavedModel, Keras model and so on. The colab gives you the model in the format imporable to TensorFlow.js. \n\n## Step 3. Run the demo application again with your own model.\n\nThe application can load the pre-trained model in [`tfjs_layers_model`](https://github.com/tensorflow/tfjs-converter#python-to-javascript). After the application is launched, the model should be put in the `dist` directory so that the application can load the model. You can find the template to create the loadable model in [Google Colab](https://colab.research.google.com/drive/1gRk3I3JudOl1u2ddvmSiVu1_ggS6hPvB).\n\n```\n$ cp -R ~/Downloads/mymobilenet.zip dist\n$ cd dist \u0026\u0026 unzip mymobilenet.zip\n$ npx parcel src/index.html --open\n```\n\nIt is also necessary to change the code to switch the loaded model. \n\n- [Switching model in web](https://github.com/Machine-Learning-Tokyo/tfjs-workshop/blob/master/web/src/index.ts#L4-L7)\n- [Switching model in web-js](https://github.com/Machine-Learning-Tokyo/tfjs-workshop/blob/master/web-js/src/index.js#L33-L37)\n\n## Step 4. Publish the application in the internet\n\nYou can publish the application in the internet by using [GitHub pages](https://pages.github.com/). Please follow the instruction in [GitHub pages](https://pages.github.com/) to bootstrap the site. Once the repository is prepared, copy the artifacts of the application in `dist` to the repository. \n\n```\n$ cd username.github.io\n$ mv /path/to/tfjs-workshop/web/dist .\n$ git add --all\n$ git commit -m \"Initial commit\"\n$ git push -u origin master\n```\n\nThen your will see the application in `http://username.github.io`.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachine-learning-tokyo%2Ftfjs-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmachine-learning-tokyo%2Ftfjs-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachine-learning-tokyo%2Ftfjs-workshop/lists"}