-
Matías Duhalde authoredMatías Duhalde authored
TD 1 : Image Classification
MOD 4.6 Deep Learning & Artificial Intelligence: an introduction
Introduction
The objective of this tutorial is to write a complete image classification program in Python. Two classification models will be successively developed and tested: k-nearest neighbors (KNN) and neural networks (NN).
Description
This project contains several files and directory. A brief description of each is given.
-
data/
: This directory contains the raw dataset, downloaded from the CIFAR-10 website. This directory should contain the foldercifar-10-batches-py/
, found within the tar file downloadable from the website. This folder is ignored from source tracking, so it should be created manually. -
tests/
: This folder contains tests for each functionality. The test files are namedtest_{source-file-to-test}.py
, and the functions to test are namedtest_{function-to-test}
. -
results/
: This folder contains some of the results generated by the program. -
knn.py
: Contains functions related to the KNN algorithm. -
read_cifar.py
: Contains functions related to reading and parsing the CIFAR-10 dataset. -
mlp.py
: Contains functions related to the Neural Network algorithm. -
main.ipynb
: Jupyter Notebook containing the main program. It is used to test the algorithms and generate the results. It also contains some descriptions regarding the algorithms, notably a mathematical description of the Neural Network algorithm.
Usage
This program was made using the latest version of Python, 3.11.5
. This program requires the following packages:
numpy==1.26.1
notebook==7.0.6
scikit-image==0.22.0
pytest==7.4.2
The CIFAR-10 dataset should be downloaded and the extracted contents should be placed a data
folder in the root of the project, before any execution.
To trigger the tests, one should simply run pytest
while on the root directory.
The main program is contained in the main.ipynb
file. It can be run using Jupyter Notebook or Jupyter Lab. The results are generated in the results
folder.
References
- Data Source : The CIFAR-10 Dataset. https://www.cs.toronto.edu/~kriz/cifar.html
- Assignment repository https://gitlab.ec-lyon.fr/edelland/mod_4_6-td1