Download the PHP package bubnov/tenserflow-bundle without Composer

On this page you can find all versions of the php package bubnov/tenserflow-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tenserflow-bundle

BubnovTensorFlowBundle

This bundle provides service and command to recognize image. Both will return RecognizeResult object.

Requirements

Installation

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

{
    ...
    "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:

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

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

Usage

When you want to use service from the controller you can simply call:

/* @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:

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

Command will return multiline string with labels and scores

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

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:

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

Configuration

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

Credits

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

Bundle code is written by Mikhail Bubnov [email protected] https://github.com/bubnov-mikhail

License

This bundle is under the MIT license.


All versions of tenserflow-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
symfony/symfony Version >=2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bubnov/tenserflow-bundle contains the following files

Loading the files please wait ....