From 0f3caaef956c23187e438fd0517501931cbfe638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Sun, 26 Nov 2023 23:44:13 +0100 Subject: [PATCH] nixify slides --- .envrc | 1 + .gitattributes | 7 +- .gitignore | 3 + docs/slides.md | 336 +++++++++++++++++++++++++++++++++++++++++++++++++ flake.lock | 61 +++++++++ flake.nix | 31 +++++ 6 files changed, 435 insertions(+), 4 deletions(-) create mode 100644 .envrc create mode 100644 docs/slides.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitattributes b/.gitattributes index 06e9508..a3495c5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,8 @@ +*.png filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text + # https://github.com/alexkaratarakis/gitattributes/blob/master/Python.gitattributes # Basic .gitattributes for a python repo. - # Source files # ============ *.pxd text diff=python @@ -10,7 +12,6 @@ *.pyx text diff=python *.pyz text diff=python *.pyi text diff=python - # Binary files # ============ *.db binary @@ -20,10 +21,8 @@ *.pyc binary export-ignore *.pyo binary export-ignore *.pyd binary - # Jupyter notebook *.ipynb text - # Note: .db, .p, and .pkl files are associated # with the python modules ``pickle``, ``dbm.*``, # ``shelve``, ``marshal``, ``anydbm``, & ``bsddb`` diff --git a/.gitignore b/.gitignore index 6af2ffb..18c4027 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.direnv +result + # https://github.com/github/gitignore/blob/main/Python.gitignore # Basic .gitignore for a python repo. diff --git a/docs/slides.md b/docs/slides.md new file mode 100644 index 0000000..e47d348 --- /dev/null +++ b/docs/slides.md @@ -0,0 +1,336 @@ +--- +marp: true +paginate: true +author: Laurent Fainsin, Damien Guillotin, Pierre-Eliot Jourdan +math: katex +--- + + + + + +# Projet IAM +## SimCLR + SGAN + +![bg 100%](https://images.unsplash.com/photo-1600174097100-3f347cf15996?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8) + + + +--- + +
+ +# Sujet + +
+ + + +Images d'animaux $\rightarrow$ 18 classes différentes + +| | | | +| :----------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------: | +| ![height:225px](https://github.com/axelcarlier/projsemisup/blob/master/Lab/Chacal/23954942153_7c3b7c0ec5_c.jpg?raw=true) | ![height:225px](https://github.com/axelcarlier/projsemisup/blob/master/Lab/Z%C3%A8bre/51854102817_e3ae6af27f_c.jpg?raw=true) | ![height:225px](https://github.com/axelcarlier/projsemisup/blob/master/Lab/autruche/48114752957_be666e72ca_c.jpg?raw=true) | +| ![height:225px](https://github.com/axelcarlier/projsemisup/blob/master/Lab/Girafe/19646362821_2cda943958_c.jpg?raw=true) | ![height:225px](https://github.com/axelcarlier/projsemisup/blob/master/Lab/Lion/51110276872_152f4fdf38_c.jpg?raw=true) | ![height:225px](https://github.com/axelcarlier/projsemisup/blob/master/Lab/Gnou/6967679426_ce23f4fef3_c.jpg?raw=true) | + +--- + +
+ +# Sujet + +
+ +### Dataset +- Données labellisées $\rightarrow$ 20 images/classe $\rightarrow$ 360 images +- Données non labellisées $\rightarrow$ 2000 images +- Données de test $\rightarrow$ 100 images/classe $\rightarrow$ 1800 images + +### Model +- Input $\rightarrow$ 128x128px +- Network $\rightarrow$ [MobileNetV1](https://www.tensorflow.org/api_docs/python/tf/compat/v1/keras/applications/mobilenet) + + + +--- + +
+ +# Méthode contrastive
(SimCLR) + +
+ +![bg 50%](https://camo.githubusercontent.com/5ab5e0c019cdd8129b4450539231f34dc028c0cd64ba5d50db510d1ba2184160/68747470733a2f2f312e62702e626c6f6773706f742e636f6d2f2d2d764834504b704539596f2f586f3461324259657276492f414141414141414146704d2f766146447750584f79416f6b4143385868383532447a4f67457332324e68625877434c63424741735948512f73313630302f696d616765342e676966) + + + +--- + +
+ +# Augmentations + +
+ +
+ +![width:800](https://1.bp.blogspot.com/-bO6c2IGpXDY/Xo4cR6ebFUI/AAAAAAAAFpo/CPVNlMP08hUfNPHQb2tKeHju4Y_UsNzegCLcBGAsYHQ/s640/image3.png) + +![width:400](https://1.bp.blogspot.com/-ZzzYCgg9g0s/Xo4bo4oj7bI/AAAAAAAAFpc/W-LAIS28d1sJ3-KETCXlaxvLKlS_KG8-QCLcBGAsYHQ/s320/image1.png) + +
+ + + +--- + +
+ +# Méthode contrastive
(SimCLR) + +
+ +![bg 50%](https://miro.medium.com/max/720/1*E6UUEmxKp5ZTRgCRNbIP-g.webp) + + + +--- + +
+ +# Contrastive loss + +
+ +$$l_{i,j} = -\log \frac{ \exp( \text{sim}(z_i, z_j) / \tau ) }{\sum^{2N}_{k=1\neq i} \exp( \text{sim}(z_i, z_j) / \tau) }$$ + + + +--- + +
+ +# Résultats fully-supervised + +
+ +![bg 98%](figs/baseline_accuracy_simclr.png) +![bg 98%](figs/baseline_loss_simclr.png) + +--- + +
+ +# Résultats semi-supervised + +
+ +![bg 98%](figs/accuracy_simclr.png) +![bg 98%](figs/loss_simclr.png) + +--- + +
+ +# Résultats supervised fine-tuning + +
+ +![bg 98%](figs/finetuning_accuracy_simclr.png) +![bg 98%](figs/finetuning_loss_simclr.png) + +--- + +
+ +# Comparaison des résultats + +
+ + + +![height:620px](figs/comp_accuracy_simclr.png) + +--- + +
+ +# Méthode générative (SGAN) + +
+ +![bg 60%](https://miro.medium.com/max/640/1*Grve_j-Mv4Jgmtq3u7yKyQ.webp) + +--- + +
+ +# Architecture du SGAN + +
+ +![bg 110%](https://cdn.discordapp.com/attachments/953586522572066826/1068158716945379358/Screenshot_from_2023-01-26_14-04-44.png) + + + +![bg 100%](https://cdn.discordapp.com/attachments/953586522572066826/1068157883717517382/a_1.png) + + + + +--- + +
+ +# Résultats générateur + +
+ + + +| | 5 epochs | 100 epochs | +| :---------------------------------------: | :----------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------: | +|

!pretrain

| ![](https://cdn.discordapp.com/attachments/953586522572066826/1068113375474753566/download4.png) | ![](https://cdn.discordapp.com/attachments/953586522572066826/1065674997672190082/download2.png) | +|

pretrain

| ![](https://cdn.discordapp.com/attachments/953586522572066826/1068115321807962122/image.png) | ![](https://cdn.discordapp.com/attachments/953586522572066826/1067144843610034227/download3.png) | + + +--- + +
+ +# Résultats fully-supervised + +
+ + + +![height:620px](figs/baseline_accuracy_sgan.png) + +--- + +
+ +# Résultats semi-supervised + +
+ + + +![height:620px](figs/accuracy_sgan.png) + +--- + +
+ +# Résultats pre-training + +
+ + + +![height:620px](figs/pretrain_accuracy_sgan.png) + +--- + +
+ +# Comparaison des résultats + +
+ + + +![height:620px](figs/comp_accuracy_sgan.png) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b79aca5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1700794826, + "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e86e1e7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = import nixpkgs { inherit system; }; + in { + devShell = pkgs.mkShell { packages = with pkgs; [ marp-cli ]; }; + + packages.slides = pkgs.stdenvNoCC.mkDerivation { + name = "slides"; + + src = ./docs; + dontUnpack = true; + buildInputs = with pkgs; [ marp-cli ]; + + buildPhase = '' + marp --html $src/slides.md --allow-local-files -o slides.html + ''; + + installPhase = '' + mkdir -p $out + cp -r $src/figs $out/figs + cp slides.html $out/index.html + ''; + }; + }); +}