PolymerLabs / arcs

Arcs
BSD 3-Clause "New" or "Revised" License
57 stars 35 forks source link

Load Images from URL with Node #3077

Open alxmrs opened 5 years ago

alxmrs commented 5 years ago

Inspired by this comment: We need a platform adapting means of loading images in arcs.

Currently, we have a way for loading images that uses the dom, but this will not work in node.

I tried to use node-canvas (npm i canvas), but it ended up creating complications for our windows build (12 iterations of build fixing with no success).

sjmiles commented 5 years ago

"Loading an image" is ill-defined. Loading a byte-stream from some URL is one thing. Decoding particular image formats is another thing. Producing a particular byte-format could be a third task.

I guess my practical question is: load for use by what specific (Node supported) API?

alxmrs commented 5 years ago

This issue came up when trying to pass image data around to the MobileNet TF model. While this model happens to take a DOM node for images (or tensorflow tensors), it's possible that other models take other formats.

You're right, there are plenty of uses for image loading. To start, I'd like a uniform way to manage data for this ML model.

alxmrs commented 5 years ago

After reading more: we could create a module dedicated to converting images into tensors. That might be the right sized solution for this problem.