How to Cook Spaghetti Aglio e Olio According to Amazon Rekognition
Tags: jokes, aws, machinelearning, tutorial
Published: 2022-11-29 22:49:10

> Renato, a Thanksgiving turkey? You are Italian, you cannot cook a turkey, you should have tried with a pizza, lasagne or some spaghetti.

This is a message I received from a friend after showing [how to cook a Thanksgiving turkey according to Amazon Rekognition](https://dev.to/aws-heroes/how-to-cook-a-thanksgiving-turkey-according-to-amazon-rekognition-3d38). I accept the challenge. Here is how to cook _Spaghetti Aglio e Olio_, a typical and widely popular dish of Neapolitan cuisine, with Amazon Rekognition. With very similar after-lunch considerations. 

You can find all the details and original steps on [RecipesFromItaly](https://www.recipesfromitaly.com/spaghetti-aglio-e-olio/). 

This is a tech recipe using [Amazon Rekognition](https://aws.amazon.com/rekognition/), a service that simplifies operational media analysis tasks by providing fully managed, purpose-built APIs powered by ML. At your peril, if you do not understand how the APIs work and how to manage confidence levels.

## The Amazon Rekognition Recipe

- First, we recommend that you cook the pasta, bringing plenty of water to a boil in a **cooking pan**. This is really quick and easy, right?

![pasta - cooking pan](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bltueb7eikukxv1ni53n.png)

- While the pasta is cooking, clean the garlic cloves. With a **toothbrush**. It's called reuse, no single-use plastic anymore. The older the toothbrush, the better.

![pasta - toothbrush](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/899q1aab2u2ha26xwbym.png)

- Then take the red chilies and cut them into thin slices. With a **dagger**. Who knew that fighting knives were so versatile?

![pasta - dagger](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8iw1pzr3fp6o1brz4ia5.png)

- Heat 6 tablespoons of extra virgin olive oil on your **plate**. Add sliced garlic and sauté for about 2 minutes. Be careful that they don’t burn. Your hands, of course. 

![pasta - plate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4c5nlwvbybaj90nzria0.png)

- Cook the pasta _al dente_. When in Rome, do as the Romans do. Cook the pasta in a **cup**.   

![pasta - cup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9gb5mt3rwdx6hu7jnr4g.png)

- Always make sure you choose ingredients of excellent quality, and do not forget your **pills** and good **chopsticks**. How else would you eat pasta?

![pasta - chopsticks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lh200rlppukvmg8ddz9j.png)

## After-Lunch Treats

This is a parody, you can read the steps on how to really cook Spaghetti Aglio e Olio on [RecipesFromItaly](https://www.recipesfromitaly.com/spaghetti-aglio-e-olio/) which owns the rights to the images used in this unconventional test. All the screenshots above are taken from the Amazon Rekognition console.

Given the low quality of the images, the weird challenge, and the likely little training of the algorithm for food recipes, Amazon Rekognition did remarkably well in labeling images.  But always remember to validate the results of your ML data, specifying a safe minimum confidence level while making API requests to Amazon Rekognition or you might end up eating spaghetti with chopsticks. 

Each label has an associated level of confidence, a number between 0 and 100 that indicates the probability that a given prediction is correct, do not just pick the first or highest label in the result set. Understanding the [BoundingBox](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_BoundingBox.html) is critical too.

Furthermore learning how [detecting labels](https://docs.aws.amazon.com/rekognition/latest/dg/labels-detect-labels-image.html) in an image works and how _LabelsCategoryExclusionFilter_ and _LabelsCategoryInclusionFilter_ can be used to filter label categories. AWS [recommends](https://docs.aws.amazon.com/rekognition/latest/dg/guidance-face-attributes.html):

> using a threshold of 99% or more for use cases where the accuracy of classification could have any negative impact on the subjects of the images. 

Buon appetito! And be careful with that dagger. 

Questions? Comments? [Contact me](https://www.linkedin.com/in/rlosio/).