{"id":15007797,"url":"https://github.com/modeldepot/tfjs-yolo-tiny","last_synced_at":"2025-04-04T15:11:41.906Z","repository":{"id":50489114,"uuid":"128573738","full_name":"ModelDepot/tfjs-yolo-tiny","owner":"ModelDepot","description":"In-Browser Object Detection using Tiny YOLO on Tensorflow.js","archived":false,"fork":false,"pushed_at":"2019-03-25T20:19:16.000Z","size":16136,"stargazers_count":532,"open_issues_count":7,"forks_count":91,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-04T15:11:36.176Z","etag":null,"topics":["browser","computer-vision","deep-learning","detection","machine-learning","npm-package","object-detection","tensorflow","tensorflow-js","tfjs","yolo","yolo-models"],"latest_commit_sha":null,"homepage":"https://modeldepot.io/mikeshi/tiny-yolo-in-javascript","language":"JavaScript","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/ModelDepot.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}},"created_at":"2018-04-07T22:26:55.000Z","updated_at":"2025-01-06T00:52:31.000Z","dependencies_parsed_at":"2022-07-30T15:48:51.012Z","dependency_job_id":null,"html_url":"https://github.com/ModelDepot/tfjs-yolo-tiny","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/ModelDepot%2Ftfjs-yolo-tiny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelDepot%2Ftfjs-yolo-tiny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelDepot%2Ftfjs-yolo-tiny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelDepot%2Ftfjs-yolo-tiny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ModelDepot","download_url":"https://codeload.github.com/ModelDepot/tfjs-yolo-tiny/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247198469,"owners_count":20900081,"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":["browser","computer-vision","deep-learning","detection","machine-learning","npm-package","object-detection","tensorflow","tensorflow-js","tfjs","yolo","yolo-models"],"created_at":"2024-09-24T19:14:00.484Z","updated_at":"2025-04-04T15:11:41.881Z","avatar_url":"https://github.com/ModelDepot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href='https://modeldepot.io/mikeshi/tiny-yolo-in-javascript'\u003e \u003cimg src='https://img.shields.io/badge/ModelDepot-Pre--trained_Model-3d9aff.svg'/\u003e \u003c/a\u003e\n\n# ⚡️ Fast In-Browser Object Detection 👀\n\nDetect objects in images right in your browser using [Tensorflow.js](https://js.tensorflow.org/)! Currently takes ~800ms\nto analyze each frame on Chrome MBP 13\" mid-2014.\n\nSupports [`Tiny YOLO`](https://pjreddie.com/darknet/yolo/), as of right now,\n [`tfjs`](https://github.com/tensorflow/tfjs) does not have\nsupport to run any full YOLO models (and your user's computers probably\ncan't handle it either).\n\n## Demo\n\n[Check out the Live Demo](https://modeldepot.github.io/tfjs-yolo-tiny-demo/)\n\n(You can only get so far with 1 FPS)\n\n![yolo person detection](https://github.com/ModelDepot/tfjs-yolo-tiny/raw/master/assets/demo.gif)\n\n## Install\n\n### Yarn\n    yarn add tfjs-yolo-tiny\n### Or NPM\n    npm install tfjs-yolo-tiny\n\n## Usage Example\n```javascript\nimport yolo, { downloadModel } from 'tfjs-yolo-tiny';\n\nconst model = await downloadModel();\nconst inputImage = webcam.capture();\n\nconst boxes = await yolo(inputImage, model);\n\n// Display detected boxes\nboxes.forEach(box =\u003e {\n  const {\n    top, left, bottom, right, classProb, className,\n  } = box;\n\n  drawRect(left, top, right-left, bottom-top, `${className} ${classProb}`)\n});\n```\n## API Docs\n\n### yolo(input, model, options)\n\n#### Args\n\nParam | Type | Default | Description\n-- | -- | -- | --\ninput | tf.Tensor | - | Expected shape (1, 416, 416, 3) Tensor representing input image (RGB 416x416)\nmodel | tf.Model | - | Tiny YOLO tf.Model\n[options] | Object | See Below | Optional, Additional Configs\n\nIf you're using a custom Tiny YOLO model or want to adjust the default\nfiltering cutoffs, you may do so by passing an additional options\nobject.\n\nExample: `yolo(inputImage, model, { classProbThreshold: 0.8 });`\n\nOption | Type | Default | Description\n-- | -- | -- | --\n| [options.classProbThreshold] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003e0.4\u003c/code\u003e | Filter out classes below a certain threshold |\n| [options.iouThreshold] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003e0.4\u003c/code\u003e | Filter out boxes that have an IoU greater than this threadhold (refer to tf.image.nonMaxSuppression) |\n| [options.filterBoxesThreshold] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003e0.01\u003c/code\u003e | Threshold to filter out box confidence * class confidence |\n| [options.maxBoxes] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003e2048\u003c/code\u003e | Number of max boxes to return, refer to tf.image.nonMaxSuppression. Note: The model itself can only return so many boxes. |\n| [options.yoloAnchors] | \u003ccode\u003etf.Tensor\u003c/code\u003e | \u003ccode\u003eSee src/postprocessing.js\u003c/code\u003e | (Advanced) Yolo Anchor Boxes, only needed if retraining on a new dataset |\n| [options.width] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003e416\u003c/code\u003e | (Advanced) If your model's input width is not 416, only if you're using a custom model |\n| [options.height] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003e416\u003c/code\u003e | (Advanced) If your model's input height is not 416, only if you're using a custom model |\n| [options.numClasses] | \u003ccode\u003eNumber\u003c/code\u003e | \u003ccode\u003e80\u003c/code\u003e | (Advanced) If your model has a different number of classes, only if you're using a custom model |\n| [options.classNames] | \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e | \u003ccode\u003eSee src/coco_classes.js\u003c/code\u003e | (Advanced) If your model has non-MSCOCO class names, only if you're using a custom model |\n\n#### Returns\n\nReturns an array of objects.\n\nProperty | Type | Description\n-- | -- | --\ntop | Number | Pixels from top of image where bounding box starts\nleft | Number | Pixels from left of image where bounding box starts\nbottom | Number | Pixels from top of image where box ends.\nright | Number | Pixels from left of image where box ends.\nclassProb | Number | Probability of the class in the bounding box.\nclassName | String | Human name of the class.\n\n### downloadModel(url)\n\n#### Args\n\nParam | Type | Default | Description\n-- | -- | -- | --\nurl | string | See DEFAULT_MODEL_LOCATION | Tiny YOLO Model config path. See [tf.loadModel](https://js.tensorflow.org/api/0.8.0/#loadModel)\n\n#### Returns\n\nReturns a `Promise` that can resolve to a `tf.Model`.\n\n# Contributing\n\nPR's are more than welcome! Perf improvement or better test coverage\nare probably the two biggest areas of immediate need. If you have thoughts\non extensibility as well, feel free to open an issue!\n\n## Install Dependencies\n```\nyarn install\n```\n\n## Run Tests\n\nIf you're running tests, make sure to `yarn add @tensorflow/tfjs@0.7.0`\nso that you you don't get tfjs package not found errors. If you're developing,\nmake sure to remove tfjs as a dependency, as it'll start using the\nlocal version of `tfjs` intead of the peer version.\n\nNote: Test coverage is poor, definitely don't rely on them to catch your errors.\n\n```\nyarn test\n```\n\n## Build\n\n```\nyarn build\n```\n\nOr during development, use watch mode, you can use the [demo app](https://github.com/ModelDepot/tfjs-yolo-tiny-demo)\nto test out changes.\n\n```\nyarn watch\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodeldepot%2Ftfjs-yolo-tiny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodeldepot%2Ftfjs-yolo-tiny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodeldepot%2Ftfjs-yolo-tiny/lists"}