OlafenwaMoses / ImageAI

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities
https://www.genxr.co/#products
MIT License
8.59k stars 2.19k forks source link

Fetching an image file from memory instead of local file system #147

Closed prateekgiria closed 5 years ago

prateekgiria commented 5 years ago

I have used the following function to fetch an image from the file system

prediction.predictImage("C:\Users\MyUser\Downloads\sample.jpg", result_count=5)

I want to know that is there any possible function which can read an image from the in-memory node instead of local file system.

I have stored the image in a no sql database and fetched that into python using REST call, I want to directly pass that into the model without saving it on to the local file system.

OlafenwaMoses commented 5 years ago

All you need to do is load the stored Image as a File stream, specify the parameter input_type="stream" and parse the file stream into the input_image parameter in the .predictImage() function.

You can also load the stored Image as a Numpy array and specify input_type="array"

See the link to the English documentation below for more explanation on this.

https://imageai.readthedocs.io/en/latest/custom/index.html