2017 © Pedro Peláez
 

symfony-bundle tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

image

bubnov/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  • Monday, January 23, 2017
  • by bubnov
  • Repository
  • 1 Watchers
  • 2 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 20 % Grown

The README.md

BubnovTensorFlowBundle

This bundle provides service and command to recognize image. Both will return RecognizeResult object., (*1)

Requirements

  • PHP 5.4 or higher
  • symfony > 2.3

Installation

To install bubnov/tenserflow-bundle with Composer just add the following to your 'composer.json' file:, (*2)

{
    ...
    "scripts": {
        "post-install-cmd": [ "TensorFlowBinaryInstaller::install" ],
        "post-update-cmd":  [ "TensorFlowBinaryInstaller::update" ]
    },
    ...
}

The next thing you should do is to install the bundle by executing the following command:, (*3)

```sh
composer require bubnov/tenserflow-bundle: ~3.0
```

Finally, add the bundle to the registerBundles function of the AppKernel class in the 'app/AppKernel.php' file:, (*4)

public function registerBundles()
{
    $bundles = array(
        ...
        new Bubnov\TensorFlowBundle\BubnovTensorFlowBundle(),
        ...
    );

Usage

When you want to use service from the controller you can simply call:, (*5)

/* @var $result \Bubnov\TensorFlowBundle\Util\RecognizerResult */
$result = $this->get('tenserflow.recognizer')->recognize('some/path/to/image'); //Returns RecognizerResult object

/* @var $label \Bubnov\TensorFlowBundle\Util\Label */
$label = $result->getTopLabel();           // Returns Label with highest score
$label->getName();                         // Returns label`s name
$label->getScore();                        // Returns label`s score

$labels = $result->getLabels();            // Returns array of Label in order of score.
$labels = $result->getLabelsScored(0.8);   // Returns array of Label in order of score with score more or equal 0.8

/**
 * Find if there are any labels in the Dictionary
 */
$dict = new \Bubnov\TensorFlowBundle\Util\Dictionary(['apple', 'fruit']);
$dict->add('blueberry');                         // Add string to the dictionary

$scoreThreshold = 0.7;                           // Optional threshold
$dict->match($result, $scoreThreshold);          // Return true or false

Where is also the command for testing images "bubnov_tensorflow:recognize". Usage:, (*6)

bubnov_tensorflow:recognize /absolute/path/to/image.ext

Command will return multiline string with labels and scores, (*7)

To create dictionary with common labels to the same images in some directory, you can call:, (*8)

find /path/to/dir/with/images -type f | parallel ./bin/console bubnov_tensorflow:fill_dict {} --tmpdict /path/to/dict.tmp

This command using GNU parallel. Optional --tmpdict may be omitted - temporary dict file will be saved to /tmp/tensorFlowBundle.dict.tmp After complete, call:, (*9)

bin/console bubnov_tensorflow:combine_dict --tmpdict /path/to/dict.tmp --dict /path/to/complete.dict

This command will create dictionary with labels and the number of their repetitions in the dict.tmp file. Now you may choose, which labels to include in Dictionary. Optional --dict may be omitted - dict file will be saved to /tmp/tensorFlowBundle.dict Optional --tmpdict may be omitted - temporary dict file will be read from /tmp/tensorFlowBundle.dict.tmp, (*10)

Configuration

This bundle will work with standalone configuration, but you may redefine some paths. It is optional and not necessary, (*11)

bubnov_tensor_flow:
    recognizer:
        binary: 'some/path/to/label_image binary'
        graph: 'some/path/to/graph.pb'
        labels: 'some/path/to/labels.txt'

Credits

This bundle is a wrapper around tenderflow`s label_image binary with tiny updates: https://github.com/tensorflow/tensorflow by The TensorFlow Authors, (*12)

Bundle code is written by Mikhail Bubnov bubnov.mihail@gmail.com https://github.com/bubnov-mikhail, (*13)

License

This bundle is under the MIT license., (*14)

The Versions

23/01 2017

dev-master

9999999-dev https://github.com/bubnov-mikhail/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  Sources   Download

MIT

The Requires

 

bundle image tenserflow recognizer

23/01 2017

3.0.6

3.0.6.0 https://github.com/bubnov-mikhail/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  Sources   Download

MIT

The Requires

 

bundle image tenserflow recognizer

23/01 2017

3.0.5

3.0.5.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  Sources   Download

MIT

The Requires

 

bundle image tenserflow recognizer

23/01 2017

3.0.4

3.0.4.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  Sources   Download

MIT

The Requires

 

bundle image tenserflow recognizer

23/01 2017

3.0.3

3.0.3.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  Sources   Download

MIT

The Requires

 

bundle image tenserflow recognizer

18/10 2016

3.0.2

3.0.2.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  Sources   Download

MIT

The Requires

 

bundle image tenserflow recognizer

30/09 2016

3.0.1

3.0.1.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  Sources   Download

MIT

The Requires

 

bundle image tenserflow recognizer

30/09 2016

3.0.0

3.0.0.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2/Symfony3 application

  Sources   Download

MIT

The Requires

 

bundle image tenserflow recognizer

09/08 2016

v1.0.1

1.0.1.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer

09/08 2016

v1.0.0

1.0.0.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer

09/08 2016

v0.1.4

0.1.4.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer

09/08 2016

v0.1.3

0.1.3.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer

09/08 2016

v0.1.2

0.1.2.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer

08/08 2016

v0.1.1

0.1.1.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer

08/08 2016

v0.1.0

0.1.0.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer

08/08 2016

v0.0.2

0.0.2.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer

08/08 2016

0.0.1

0.0.1.0 https://github.com/bubnovKelnik/tenserflow-bundle

Integrates tenserflow recognizer into your Symfony2 application

  Sources   Download

MIT

The Requires

  • php >=5.5

 

bundle image tenserflow recognizer