/laravel-object-detection

Identifies objects in an image using Machine Learning.

Primary LanguagePHPMIT LicenseMIT

Laravel Object Detection

Latest Version on Packagist Total Downloads

This package identifies objects in an image using Machine Learning, TensorFlow and the coco-ssd model.

Example

Installation

You can install the package via composer:

composer require livijn/laravel-object-detection

You should att this to your composer.json file to ensure that our package is fully installed.

"scripts": {
    "post-install-cmd": [
        "(cd vendor/livijn/laravel-object-detection && npm i)"
    ]
}

Installation on Laravel Forge

If you are deploying on Laravel Forge, make sure you have sufficient node & npm versions. You can read this article on how to update nodejs on Forge.

To update npm, just run sudo npm install -g npm@latest on your server.

I have only verified this works with these versions:

  • node >= 16
  • npm >= 7

Usage

LaravelObjectDetection::getObjectsFromImageUrl('https://some-url.com/some-image.jpg');

// Returns an ImageObjectCollection
// [{"class":"dog","score":0.973773181438446,"boundingBox":[239.84360694885254,75.59387746453285,505.188524723053,590.4131692349911]}]

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ouff@live.se instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.