Google Colab and ailia MODELS to Perform AI in the Browser
This explains how to easily perform AI processing in the browser alone using Google Colab and ailia MODELS.
About Google Colab
Google Colaboratory is a virtual environment that allows you to run Python in the browser. It enables you to execute AI models on a server for free.
About ailia MODELS
ailia MODELS is a library of AI models provided by ax Inc. With over 300 models available, it allows you to perform a large variety of AI tasks.
Using ailia MODELS in Google Colab
ailia MODELS includes sample programs for Google Colab available at the link below.
You can run the program from the menu below.
The sample downloads all the necessary resources, run the inference and display the detection result.
Run the inference on your own image
To infer with other images, browse the colab files from the left side menuFile
icon and select the folderailia-models/object_detection/yolox
. You can upload your own image using the 3-dot menu attached to the folder.
Change the script input.jpg
to the uploaded file, cocker.jpg
in this example, and run the two last cells to update the inference result.
Use other ailia MODELS in Google Colab
You can edit the colab notebook to run inference using other AI models. Let’s see how to do it to use the segmentation model Detic.
First upload the sample image in the ailia-models/object_detection/detic
folder as we did previously.
Then adapt the inference command from
!cd ailia-models/object_detection/yolox && python3 yolox.py
to
!cd ailia-models/object_detection/detic && python3 detic.py -i cocker.jpg
Make sure not to forget the !
mark at the beginning for the command to be executed in the system shell rather than in the Python environment.
Also edit the command in the last cell from
from IPython import display
display.Image("ailia-models/object_detection/yolox/output.jpg")
to
from IPython import display
display.Image("ailia-models/object_detection/detic/output.png")
Installation of all dependencies
By default, only opencv-python
and numpy
are installed to make the first execution faster. If an error occurs during execution of other models, most likely due to missing libraries, please uncomment and run pip3 install -r ailia-models/requirements.txt
to install all the necessary dependencies.
ax Inc. has developed ailia SDK, which enables cross-platform, GPU-based rapid inference.
ax Inc. provides a wide range of services from consulting and model creation, to the development of AI-based applications and SDKs. Feel free to contact us for any inquiry.