{"id":18976888,"url":"https://github.com/a11ywatch/tensornet","last_synced_at":"2026-05-03T07:46:54.641Z","repository":{"id":48329009,"uuid":"505136140","full_name":"a11ywatch/tensornet","owner":"a11ywatch","description":"MobileNet + ImageNet predictions in nodejs without node-canvas","archived":false,"fork":false,"pushed_at":"2023-08-05T22:19:59.000Z","size":374,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-04T21:41:16.098Z","etag":null,"topics":["tensorflow","tensornetwork"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/a11ywatch.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},"funding":{"github":["a11ywatch"]}},"created_at":"2022-06-19T14:42:13.000Z","updated_at":"2023-07-29T18:07:12.000Z","dependencies_parsed_at":"2024-06-21T19:16:01.887Z","dependency_job_id":null,"html_url":"https://github.com/a11ywatch/tensornet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/a11ywatch/tensornet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Ftensornet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Ftensornet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Ftensornet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Ftensornet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a11ywatch","download_url":"https://codeload.github.com/a11ywatch/tensornet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a11ywatch%2Ftensornet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32562118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["tensorflow","tensornetwork"],"created_at":"2024-11-08T15:26:44.673Z","updated_at":"2026-05-03T07:46:54.617Z","avatar_url":"https://github.com/a11ywatch.png","language":"TypeScript","funding_links":["https://github.com/sponsors/a11ywatch"],"categories":[],"sub_categories":[],"readme":"# tensornet\n\n[![Build and lint](https://github.com/A11yWatch/tensornet/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/A11yWatch/tensornet/actions/workflows/tests.yml)\n\npure js classify base64 between Tensorflow Models\n\n## Installation\n\n```\nnpm i tensornet --save\n```\n\n## Getting Started\n\nMake sure to have `@tensorflow/tfjs-core` installed and a valid tensorflow backend set.\nYou also need to pick between [sync package jpeg-js](https://github.com/jpeg-js/jpeg-js) or [async package sharp](https://github.com/lovell/sharp).\n\n```sh\n# pure js full sync blocking installation\nnpm i @tensorflow/tfjs-core jpeg-js\n# if going to use async non blocking\nnpm i @tensorflow/tfjs-core sharp\n```\n\nView the [classify.test.ts](./__tests__/classify.test.ts) file for an example setup.\n\n```ts\nimport { classify, classifyAsync } from \"tensornet\";\nimport { setBackend } from \"@tensorflow/tfjs-core\";\nimport \"@tensorflow/tfjs-backend-wasm\";\n\nawait setBackend(\"wasm\");\n\nconst classification = await classify(mybase64); //using jpeg-js.\n// or use native sharp for increased performance 2x\nconst classificationA = await classifyAsync(mybase64);\n// output example\n// [\n//   {\n//     className: 'Siamese cat, Siamese',\n//     probability: 0.9805548787117004\n//   }\n// ]\n```\n\n## Why\n\nThe benefits of using pure js to calc the image is in a couple areas:\n\n1. size and portablity required is drastically less since you do not need `cairo` or any of the native img dev converters.\n1. speed is also faster since the calcs are done at hand without needing to bridge any calls.\n1. can use tensors in worker threads - allows for properly using Tensorflow wasm backends in an API service 🥳.\n\nThe TF models are checked in localy.\n\n## Benchmarks\n\nExamples of some test ran on a mac m1(64gb):\n\n| Name | chars | size     | sync  | async |\n| ---- | ----- | -------- | ----- | ----- |\n| jpeg | 26791 | 26.16 KB | 100ms | 50ms  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa11ywatch%2Ftensornet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa11ywatch%2Ftensornet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa11ywatch%2Ftensornet/lists"}