0% found this document useful (0 votes)
31 views2 pages

Pokemon

The document outlines a project focused on multi-label classification for predicting Pokemon types using convolutional neural networks (CNNs). It details the steps for preprocessing images, building a CNN for primary type detection, and extending it to detect both primary and secondary types. The project includes instructions for data normalization, model training, and performance evaluation using confusion matrices.

Uploaded by

aoudacht.imane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

Pokemon

The document outlines a project focused on multi-label classification for predicting Pokemon types using convolutional neural networks (CNNs). It details the steps for preprocessing images, building a CNN for primary type detection, and extending it to detect both primary and secondary types. The project includes instructions for data normalization, model training, and performance evaluation using confusion matrices.

Uploaded by

aoudacht.imane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Multi label classification ‑ Pokemon type detection 2024/2025

Project 2 : Multi label classification ‑ Pokemon type predictions

In this lab, we will build a convolutional neural network capable of predicting the primary and secondary type of any
given Pokemon.

Figure 1: wobbuffet, type : Psychic

The goal of this project is to learn how to:

• preprocess images
• use CNNs
• do multi label classification

The project contains a zipped file of all the images of pokemons, as well as pokemon.csv file that contains the labels
of each pokemon.

The images are in multiple formats (png,jpg). However the names of images are the same in the column
Á Name of pokemon.csv.

1 Primary type detection

We shall start by predicting the primary type of the Pokemon (labelled as Type 1 in pokemon.csv).

• Using the Name column, link each image to its label. Then open the image in RGB format with a size of (120 × 120).

You can use the pillow library. You can use :


b
1. Open images : open() ‑ https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Ima
ge.open
2. Convert the color channel format : convert ‑ https://pillow.readthedocs.io/en/stable/reference/
Image.html#PIL.Image.Image.convert (See the available modes)
3. Resize an image : resize() ‑ https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.I
mage.Image.resize

• Normalize the three channels (./255) and then split the data into training and testing.
• Check the distribution of pokemon types. Apply the adequate method in case of imbalance (Weighted learning,
SMOTE).

Anasse Chafik ‑ ENSAT 1


Multi label classification ‑ Pokemon type detection 2024/2025

• Use labelling encoding on the labels.


• Build A CNN structure using Conv2D, Max Pooling (You can build a deeper neural network) and other layers
(Dropout, Batch Normalization) to prevent overfitting. The output should have n_classes neurons with
sigmoid as an activation function.
• Use adam gradient descent, cross entropy loss and accuracy metrics as parameters for training the model.
• Train the CNN and evaluate its performance.
• Use the confusion matrix to show the perfomance of the model.
• Make some predictions with your model.

2 Going further: primary and secondary type detection

In the following, we shall build a multi label classifier for detecting the primary and secondary type.

• Merge Type1 and Type2 into one column Types. You should replace any null value of Type2 by an empty string
"". The values under the Types column should be an array of the Pokemon types (eg: [grass,poison])
• Use Multi label binarizer to encode the types.
• Prepare your samples similarly to Section 1.
• Build A CNN structure using Conv2D, Max Pooling (You can build a deeper neural network) and other layers
(Dropout, Batch Normalization) to prevent overfitting. However, The output should have n_classes neurons
with sigmoid an activation function for each neuron. The goal here is that each output neuron i is capable of
predicting if a Pokemon is of type_i or not.
• Use adam gradient descent, binary cross entropy loss and accuracy metrics as parameters for training the model.
• Train the multi label CNN and evaluate its performance.
• Use the confusion matrix to show the perfomance of the model.
• Make some predictions with your model.

Anasse Chafik ‑ ENSAT 2

You might also like