Message Boards Message Boards

Cloud Deploy broken with neural net (new?)

GROUPS:

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. 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

POSTED BY: Maximilian Jakobs
Answer
8 days ago

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
Answer
4 days ago

Group Abstract Group Abstract