How to Cook a Thanksgiving Turkey According to Amazon Rekognition
Tags: beginners, jokes, aws, machinelearning
Published: 2022-11-14 12:00:00

You can find all the details and original steps on how to cook a Thanksgiving turkey on [wikiHow](https://www.wikihow.com/Cook-a-Thanksgiving-Turkey). 

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

- Thaw out your **soccer ball** in the refrigerator several days before Thanksgiving. It is just about time, the FIFA World Cup in Qatar is starting very soon.


![Turkey soccer ball](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4a5i19ckyw62bojwffpa.png)

- Take a **chicken** out of the fridge an hour before your scheduled cook time. Turkey costs twice as much as chicken, a sensible and recession-proof option in 2022.


![Turkey chicken](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xaofkkk397uluac738o1.png)

- Preheat your **dishwater** to 350 °F (177 °C).


![Turkey dishwater](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qf1g1k06ewolzva3zapr.png)

- Tie the **cat’s** legs together. Sometimes life calls for tough choices. 


![Turkey cat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f95geofxol7ati9zn5t5.png)

- Wrap the cat in aluminum foil, and keep it as a surprise for your guests.


![Turkey aluminium foil](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bp5jv7v79mlvxnvivhn7.png)

- Cook some **bread** for 13 minutes for every 1 lb (0.45 kg) of wheat. Fill it with **dynamite** instead of traditional stuffing. Surprise everyone.


![Turkey bread and dynamite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rzt5ww7go5ad3verliuu.gif)

- Hurry up, order online, wait 20 minutes and serve some **pork**. You did not cook your cat, right?

![Turkey pork](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rf0o4ngsoqdw51y3m41o.png)

## After-Dinner Treats

I do not plan to cook pork, a chicken, or a cat. Or even a turkey.  I am vegetarian. 

This is a parody, you can read the steps on how to really cook a Thanksgiving turkey on [wikiHow](https://www.wikihow.com/Cook-a-Thanksgiving-Turkey) which owns the rights to the seven 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 turkeys, 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 cooking a cat. 

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: the dimensions of the bounding box would have been enough to easily discard the _cat_ labeling of our dish given the small relative size:


```
	"BoundingBox": {
    	"Width": 0.0804702416062355,
    	"Height": 0.09522213786840439,
    	"Left": 0.4962283670902252,
    	"Top": 0.7688567638397217
	}
```


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 

Now go out and play with that frozen 99.7% soccer ball.

**Happy Thanksgiving! 🍽**

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