{"id":17355333,"url":"https://github.com/kevinanielsen/tfjs-image-node","last_synced_at":"2026-02-04T00:36:15.266Z","repository":{"id":212261413,"uuid":"707686771","full_name":"kevinanielsen/tfjs-image-node","owner":"kevinanielsen","description":"A simple image classifier using tfjs, that can run in Node.js","archived":false,"fork":false,"pushed_at":"2024-12-14T10:12:54.000Z","size":2116,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T05:45:26.961Z","etag":null,"topics":["ai","learning","machine","ml","node","tensorflow","tensorflowjs","tf","tfjs","tfjs-node","typescript"],"latest_commit_sha":null,"homepage":"https://kevinanielsen.github.io/tfjs-image-node/","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/kevinanielsen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-10-20T12:43:57.000Z","updated_at":"2024-09-29T18:08:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"d1ae72fe-f8c5-44e5-a38c-3a4fb0fd6def","html_url":"https://github.com/kevinanielsen/tfjs-image-node","commit_stats":null,"previous_names":["kevinanielsen/tfjs-image-node"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinanielsen%2Ftfjs-image-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinanielsen%2Ftfjs-image-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinanielsen%2Ftfjs-image-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinanielsen%2Ftfjs-image-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinanielsen","download_url":"https://codeload.github.com/kevinanielsen/tfjs-image-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975328,"owners_count":21192210,"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":["ai","learning","machine","ml","node","tensorflow","tensorflowjs","tf","tfjs","tfjs-node","typescript"],"created_at":"2024-10-15T17:43:00.801Z","updated_at":"2026-02-04T00:36:15.214Z","avatar_url":"https://github.com/kevinanielsen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tfjs-image-node\n\n[![Known Vulnerabilities](https://snyk.io/test/github/dwyl/hapi-auth-jwt2/badge.svg?targetFile=package.json)](https://snyk.io/test/github/kevinanielsen/tfjs-image-node?targetFile=package.json)\n[![npm version](https://badge.fury.io/js/tfjs-image-node.svg)](https://badge.fury.io/js/tfjs-image-node)\n[![CI](https://github.com/kevinanielsen/tfjs-image-node/actions/workflows/main.yml/badge.svg)](https://github.com/kevinanielsen/tfjs-image-node/actions/workflows/main.yml)\n\nA simple image classifier using tfjs, that can run in Node.js\n\n### Install\n\n```bash\nnpm i tfjs-image-node\n# or\npnpm add tfjs-image-node\n```\n\n### Import\n\ntfjs-image-node has two different exports. One for the tfjs-node platform and one for the regular tfjs package - one package is preferred for operations in the node runtime, the other is preferred for regular javascript.\n\n```typescript\nconst classifyImage = require(\"tfjs-image-node\");\n// or\nimport classifyImage from \"tfjs-image-node\";\n```\n\n## Example\n\n```typescript\nimport classifyImage from \"tfjs-image-node/node\";\n\nconst model = \"https://teachablemachine.withgoogle.com/models/jAIOHvmge\";\nconst image = \"https://www.stgeorges.nhs.uk/wp-content/uploads/2014/03/hand-2.jpeg\";\n\n// With tfjs-node as the platform\n(async () =\u003e {\n\tconst prediction = await classifyImage(model, image);\n\tconsole.log(prediction[0]);\n})();\n\n// With classic tfjs as the platform\n(async () =\u003e {\n\tconst prediction = await classifyImage(model, image, \"classic\");\n\tconsole.log(prediction[0]);\n})();\n\n// expected output:\n// { label: 'Hand', probability: 0.9999574422836304 }\n```\n\n## Parameters\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eName\u003c/td\u003e\n      \u003ctd\u003eType\u003c/td\u003e\n      \u003ctd\u003eDescription\u003c/td\u003e  \n    \u003c/tr\u003e\n  \u003c/thead\u003e  \n  \u003ctdata\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        MODEL_URL\n      \u003c/td\u003e\n      \u003ctd\u003e\n        string\n      \u003c/td\u003e\n      \u003ctd\u003e\n        The URL to your AI model (currently only supports teachable machine URLs like \"https://teachablemachine.withgoogle.com/models/{model_id}\".\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        IMAGE_FILE_PATH\n      \u003c/td\u003e\n      \u003ctd\u003e\n        string\n      \u003c/td\u003e\n      \u003ctd\u003e\n        The file path or URL to the image you want classified.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        PLATFORM\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \"node\" or \"classic\" (optional)\n      \u003c/td\u003e\n      \u003ctd\u003e\n        Choose the platform to use for the computation of the prediction. If you want to use the tfjs-node platform, use \"node\" as the parameter, otherwise use \"classic\".\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        METADATA\n      \u003c/td\u003e\n      \u003ctd\u003e\n        metadata.json (optional)\n      \u003c/td\u003e\n      \u003ctd\u003e\n        If you want to specify a set of metadata for the model.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tdata\u003e\n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinanielsen%2Ftfjs-image-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinanielsen%2Ftfjs-image-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinanielsen%2Ftfjs-image-node/lists"}