---
title: "Image recognition with GluonCV and the Notebooks"
canonical: "https://onesaitplatform.refined.site/space/DOCT/2220806840/Image%20recognition%20with%20GluonCV%20and%20the%20Notebooks"
format: markdown
---
[**GluonCV**](https://gluon-cv.mxnet.io/) is an open-source Deep Learning toolkit for artificial vision. GluonCV offers ready-to-use implementations of Deep Learning algorithms in this environment, allowing for:

It supports:

- Image classification.
- Object detection.

![image]()

- semantic segmentation (associate each pixel of an image with a categorical label).

![image]()

- Instance segmentation.

![image]()


GluonCV depends on MXNet and works with Python 2.7 or higher.

In this example, we will see how we can use GluonCV from the platform's notebook for image object recognition, with images that are provided to the platform as parameters.

- Let's start by creating a Notebook and, in its first paragraph, we install GluonCV and MXNet:

![image](media://f090ca63-46f0-467b-a12b-3313cf547000)

- Now we import the pre-trained models we will use:

![image](media://a22fe5e2-e16d-4a15-a73a-72bb287be5d2)

- And we load an SSD input model with images, on a VOC Pascal Dataset with <span style="color: #404040">ResNet-50 V1 as its base model:</span>

![image](media://2a408851-3bfe-4b1c-8e02-d72caf25915c)

<span style="color: #404040">By specifying </span>`pretrained=True `<span style="color: #404040">we will have the model downloaded (You can find more trained models).</span>

- <span style="color: #404040">To test that it works, I will use one of GluonCV's example images.</span>

![image](media://91595366-8ee4-4bde-a710-ed2694234aa2)

<span style="color: #404040">I first download the image, then I pre-process it, </span><span style="color: #404040">resizing it to </span><span style="color: #404040">512x512 pixels.</span>

<span style="color: #404040">The function returns two results: First, an NDArray with the </span><span style="color: #404040">shape </span><span style="color: #404040"> </span>*<span style="color: #404040">(batch_size, RGB_channels, height, width) </span>*<span style="color: #404040">which we can pass to the model; secondly, an array with the image in numpy format, so we can display it.</span>

- And finally we perform the inference and the display:

![image](media://136f5a68-39d7-41d2-b253-7c3d358dded4)

The function returns all the detected container boxes with their Class IDs and prediction trust.


- We will now extend the notebook to provide it, as a parameter, the image on which we want recognition done. To do this, we create a new paragraph to pass the URL as a parameter.

I first create a z.input to store the parameter:

![image](media://e34bc46a-43a4-4a4d-b3bd-81e4ebcc5d02)

Then I use this image:

![image](media://a81af0f4-52a3-4835-aa65-d929a6dbed78)