module restapi.search_images_dogcat

Short summary

module ensae_projects.restapi.search_images_dogcat

Defines a search engine for images inspired from # searchimagesrst>`_. Search images with deep learning <http://www.xavierdupre.fr/app/mlinsights/helpsphinx/notebooks/search_images.html It relies on :epkg:`lightmlrestapi.

source on GitHub

Functions

function

truncated documentation

_search_images_dogcat_keras

_search_images_dogcat_torch

search_images_dogcat

Defines a REST application. It returns a list of neighbors among a small set of images representing dogs …

Documentation

Defines a search engine for images inspired from # searchimagesrst>`_. Search images with deep learning <http://www.xavierdupre.fr/app/mlinsights/helpsphinx/notebooks/search_images.html It relies on :epkg:`lightmlrestapi.

source on GitHub

ensae_projects.restapi.search_images_dogcat._search_images_dogcat_keras(app=None, url_images=None, dest=None, fLOG=None)
ensae_projects.restapi.search_images_dogcat._search_images_dogcat_torch(app=None, url_images=None, dest=None, fLOG=None)
ensae_projects.restapi.search_images_dogcat.search_images_dogcat(app=None, url_images=None, dest=None, module='torch')

Defines a REST application. It returns a list of neighbors among a small set of images representing dogs and cats. It relies on torch or keras.

Parameters
  • app – application, if None, creates one

  • url_images – url or path to the images

  • dest – destination of the images (where to unzip)

  • modulekeras or torch

Returns

app

You can start it by running:

start_dogcatrestapi

And then query it with:

import requests
import ujson
from lightmlrestapi.args import image2base64
img = "path_to_image"
b64 = image2base64(img)[1]
features = ujson.dumps({'X': b64})
r = requests.post('http://127.0.0.1:8081', data=features)
print(r)
print(r.json())

It should return:

{'Y': [[[41, 4.8754486973, {'name': 'wiki.png', description='something'}]]]}

source on GitHub