MATLAB Answers

Can MATLAB ResNet50 be run on Google Colab Pro?

169 views (last 30 days)
Just now came across this new video showing that MATLAB code can be run on Google Colab by installing Octave first. Any ideas on how to get a MATLAB ResNet50 model to run on Colab, too? This is important because Colab has a GPU for my 5204 images.

Accepted Answer

Walter Roberson
Walter Roberson on 20 Jul 2021
  3 Comments
Dr. Anna Haywood
Dr. Anna Haywood on 21 Jul 2021
Thank so much for your help and link! I clicked on it and am investigating this new Python world ;-)

Sign in to comment.

More Answers (2)

Joss Knight
Joss Knight on 19 Jul 2021
I'm not sure how in-guidelines it is to be asking about running Octave as a substitute for MATLAB on this forum! I'm pretty sure, however, that ResNet50 is very unlikely to work in Octave.
If you want cloud solutions for running MATLAB you should start here (but Google is not one of the options). Have you considered just using MATLAB Online, for instance, and MATLAB Drive for your data storage?

Dr. Anna Haywood
Dr. Anna Haywood on 20 Jul 2021
I have tried both MATLAB Online and desktop with Statistics and Machine Learning Toolbox installed. Unfortunately, desktop takes about 18 hours to process my 5204 images through ResNet50. Then, MATLAB Online either times out or runs out of memory and also does not appear to have a GPU.
I have also tried my college where I teach which has a site license for just regular MATLAB but no ML toolbox. Been trying to find a solution for about a month. Gotta be some way to use ResNet50 in an efficient manner?
  1 Comment
Joss Knight
Joss Knight on 20 Jul 2021
The obvious answer is 'get a GPU'! but I'm assuming your question is just how can I rent a GPU? There are many options if you follow the link I gave. It basically revolves around renting a machine with a GPU in Amazon EC2 or Azure and installing MATLAB there using one of the images available. A neat option is the MATLAB GPU container which you can use through the NVIDIA GPU Cloud.
If what you want is a way for MathWorks to provide you with a rented machine with a GPU without you also having to have an account with a cloud service provider then unfortunately...MATLAB online is all we provide, and those machines don't have GPUs. Hosting machines in the cloud is expensive, machines with GPUs - very expensive. But we're working on some solutions, perhaps that will involve some sort of pay-as-you-go through your MathWorks account.
If you're willing to consider buying a GPU for your desktop then that's an obvious solution, you don't need much if you don't want the latest card (try a GTX 1050 perhaps).
Also worth asking, are you training Resnet50, or just using it? I'm guessing you're fine-tuning? If you're just using it for prediction then it certainly shouldn't be taking 18 hours, even on a slow CPU. If you're training, how many epochs do you need to fit to your data? Have you considered trying a smaller model (squeezenet or mobilenet perhaps)?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by