{"id":13828311,"url":"https://github.com/ankitpokhrel/alt","last_synced_at":"2025-04-14T10:21:15.446Z","repository":{"id":62485998,"uuid":"172541343","full_name":"ankitpokhrel/alt","owner":"ankitpokhrel","description":"[EXPERIMENTAL] Facebook-like automatic alternative (alt) text for images using object detection with pre-trained model.","archived":false,"fork":false,"pushed_at":"2025-01-27T08:03:49.000Z","size":33679,"stargazers_count":83,"open_issues_count":1,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T14:46:11.017Z","etag":null,"topics":["autotext","deep-neural-network","made-in-nepal","object-detection","opencv","php-library","php-opencv","php7","single-shot-detection"],"latest_commit_sha":null,"homepage":"https://captionai.co","language":"PHP","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/ankitpokhrel.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}},"created_at":"2019-02-25T16:23:14.000Z","updated_at":"2025-01-27T08:03:52.000Z","dependencies_parsed_at":"2022-11-02T10:15:28.708Z","dependency_job_id":null,"html_url":"https://github.com/ankitpokhrel/alt","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"cda0cd5497c59957d5220b75af37a55faa24bb09"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitpokhrel%2Falt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitpokhrel%2Falt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitpokhrel%2Falt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitpokhrel%2Falt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankitpokhrel","download_url":"https://codeload.github.com/ankitpokhrel/alt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860006,"owners_count":21173344,"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":["autotext","deep-neural-network","made-in-nepal","object-detection","opencv","php-library","php-opencv","php7","single-shot-detection"],"created_at":"2024-08-04T09:02:40.857Z","updated_at":"2025-04-14T10:21:15.427Z","avatar_url":"https://github.com/ankitpokhrel.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# alt \u0026nbsp;[![Build Status](https://img.shields.io/travis/ankitpokhrel/alt/master.svg?style=flat-square)](https://travis-ci.org/ankitpokhrel/alt)\n\n\u003e This project is no longer maintained.\n\n_Automatic alternative (alt) text for images using object detection with pre-trained model._\n\n### Overview\n\nA very simple PHP library to generate alternative (alt) text for images using pre-trained tensorflow model to detect objects in an image. These texts can provide context about image to visitors who are unable to see images in their browser for whatever reasons. Alt texts can also be picked up by screen readers to convert it to speech, thus, providing additional context to visually impaired people and enhancing our user experience.\n\n\u003e This nifty little tool is inspired by [facebook alt text generation](https://code.fb.com/ios/under-the-hood-building-accessibility-tools-for-the-visually-impaired-on-facebook/) process.\n\n### Example\n| | | | |\n|-|-|-|-|\n| \u003cimg src=\"tests/images/workplace.jpg\" width=\"300\" alt=\"Image may contain: cup, potted plant, laptop\"\u003e \u003cbr\u003e_Image may contain: cup, potted, laptop_ | \u003cimg src=\"tests/images/people.jpg\" width=\"300\" alt=\"Image may contain: 6 person, cup, laptop\"\u003e \u003cbr\u003e_Image may contain: 6 person, cup, laptop_ | \u003cimg src=\"tests/images/street.jpg\" width=\"300\" alt=\"Image may contain: 5 person, car, motorcycle\"\u003e \u003cbr\u003e_Image may contain: 5 person, car, motorcycle_ | \u003cimg src=\"tests/images/london.jpg\" width=\"300\" alt=\"Image may contain: 1 person, car, bus, truck, traffic light\"\u003e \u003cbr\u003e_Image may contain: 1 person, car, bus, truck, traffic light_ |\n| \u003cimg src=\"tests/images/home.jpg\" width=\"300\" alt=\"Image may contain: chair, couch\"\u003e \u003cbr\u003e_Image may contain: chair, couch_ | \u003cimg src=\"tests/images/pizza.jpg\" width=\"300\" alt=\"Image may contain: pizza, dining table\"\u003e \u003cbr\u003e_Image may contain: pizza, dining table_ | \u003cimg src=\"tests/images/dog.jpg\" width=\"300\" alt=\"Image may contain: dog\"\u003e \u003cbr\u003e_Image may contain: dog_ | \u003cimg src=\"tests/images/birds.jpg\" width=\"300\" alt=\"Image may contain: bird\"\u003e \u003cbr\u003e_Image may contain: bird_ |\n\n### Installation\n\n\u003e Requires: PHP 7.1.3+, [OpenCV](https://opencv.org/), [PHP OpenCV](https://github.com/php-opencv/php-opencv)  \n\u003e Model used:  [SSDLite COCO v2](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md)\n\nPull the package via composer.\n```shell\n$ composer require ankitpokhrel/alt\n```\n\n### Usage\n\n```php\n$alt = new \\Alt\\Alt('/path/to/image.ext');\n\necho $alt-\u003ealt(); // Image may contain: 6 person, cup, laptop\n\n$alt-\u003esetImage('/path/to/image.ext')-\u003ealt(); // Image may contain: car, motorcycle\n```\n\n### Threshold\n\nThe classification threshold is set to `30` by default. You can adjust it as your need.\n\n```php\n$alt-\u003esetThreshold(25);\n```\n\n### Prefix\n\nBy default the alt is prefixed with `Image may contain: `. You can change this as below:\n\n```php\n$alt-\u003esetPrefix('Image has: ');\n```\n\n### Countable\n\nIf you want to display the count of an object, you can do so by setting `countable` array. `person` is countable by default.\n\n```php\n$alt-\u003esetImage('/path/to/image.ext')-\u003ealt(); // Image may contain: 5 person, dog, cup\n\n// Adding dog as countable\n$alt-\u003esetCountable(['person', 'dog'])-\u003ealt(); // Image may contain: 5 person, 2 dog, cup\n```\n\n### Default text\n\nDefault text is used if the model is not able to predict any objects within a given threshold. Default default text is `No photo description available.`.\n\n```php\n$alt-\u003esetDefaultText('Some scenery.');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitpokhrel%2Falt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankitpokhrel%2Falt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitpokhrel%2Falt/lists"}