Message Boards Message Boards

Do neural nets work with cloud deployment?

Posted 6 years ago

Over the last few weeks I routinely deployed neural nets to the cloud for computation. Today, even the simplest example does not work anymore:

(*initialise random neural net that talkes 200x200 image as input*)
scrnet = NetInitialize@
  NetChain[{ConvolutionLayer[1, 1], PartLayer[1]}, "Input" -> {1, 200, 200}]

(*Deploy to cloud*)
cnet = CloudExport[scrnet, "MX", Permissions -> "Public"];

(*test on example image *WORKS**)
img = Import["ExampleData/ocelot.jpg"];
With[{net = CloudImport@cnet}, Image@net@{ImageData@img}]

(*Deploy as cloud form page *)
CloudDeploy[FormPage[{"image" -> "Image"}, 
  With[{net = CloudImport@cnet}, Image@net@{ImageData@#image}] &], 
 Permissions -> "Public"]

The last piece of code generates a cloud object. If I try to upload the ocelot image I get Image[Failed] as the sole output.

enter image description here

If I do not use a net the form works fine:

CloudDeploy[FormPage[{"image" -> "Image"}, Image@ImageData@#image &], 
   Permissions -> "Public"]

I contacted wolfram support already and they told me to post here. Am I doing something wrong? I have ~1000 cloud credits left on a free account so that should not be the issue. Frankly, I am having a lot of issues with the documentation for cloud computing in general and am starting to wonder if it is worth the hassle.

Best, Max

2 Replies

This net requires a 200 x 200 color image, like the ocelot. When I use the ocelot - by first exporting it as a PNG - it works as expected in the web form (although the result is just a black image).

Are you using a different image or not transferring it in an image format?

POSTED BY: Bob Sandheinrich

Having a similar issue, but with a much larger net. I used transfer learning to make a custom version of VGG-19/ImageNet. It works fine locally. CloudDeploy took about an hour and ballooned memory to something like 24GB! It finally finished, without an error, but trying to load the URL produces {"errorCode":"no-wolfram-engine-response","statusCode":503,"errorDetails":"Unable to evaluate"} The upload code in question is

link = URLShorten[
  CloudDeploy[
   FormFunction[{"photo" -> "Image"}, 
    vggNetClassifier[#photo, "TopProbabilities" -> 2] &], 
   Permissions -> "Public"]]

Is it just too big a function to deploy? I hope not if Wolfram is serious about making deep learning easy to use and deploy...

POSTED BY: Gareth Russell
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract