vault backup: 2024-11-29 15:32:17
97
.obsidian/workspace.json
vendored
|
@ -13,70 +13,15 @@
|
|||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "Biometric Systems/notes/12. Iris recognition.md",
|
||||
"file": "Foundation of data science/notes/7 Autoencoders.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "12. Iris recognition"
|
||||
"title": "7 Autoencoders"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "5b545e7467150d86",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "d0f857717f626133",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "pdf",
|
||||
"state": {
|
||||
"file": "Biometric Systems/slides/Biometric_System___Notes.pdf",
|
||||
"page": 29,
|
||||
"left": 56,
|
||||
"top": 111,
|
||||
"zoom": 1
|
||||
},
|
||||
"icon": "lucide-file-text",
|
||||
"title": "Biometric_System___Notes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9bf2709eda88f097",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "pdf",
|
||||
"state": {
|
||||
"file": "Biometric Systems/slides/Riassunto_2021_2022.pdf",
|
||||
"page": 47,
|
||||
"left": -4,
|
||||
"top": 846,
|
||||
"zoom": 0.81
|
||||
},
|
||||
"icon": "lucide-file-text",
|
||||
"title": "Riassunto_2021_2022"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "cc1957238a7c12e4",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "pdf",
|
||||
"state": {
|
||||
"file": "Biometric Systems/slides/LEZIONE10_Iris recognition.pdf",
|
||||
"page": 2,
|
||||
"left": -42,
|
||||
"top": 4,
|
||||
"zoom": 0.3583333333333334
|
||||
},
|
||||
"icon": "lucide-file-text",
|
||||
"title": "LEZIONE10_Iris recognition"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currentTab": 2
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
|
@ -132,8 +77,7 @@
|
|||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 300,
|
||||
"collapsed": true
|
||||
"width": 300
|
||||
},
|
||||
"right": {
|
||||
"id": "bc4b945ded1926e3",
|
||||
|
@ -249,28 +193,29 @@
|
|||
},
|
||||
"active": "029fd45331b34705",
|
||||
"lastOpenFiles": [
|
||||
"Biometric Systems/images/Pasted image 20241127134548.png",
|
||||
"Foundation of data science/images/Pasted image 20241129142615.png",
|
||||
"Foundation of data science/images/Pasted image 20241129150144.png",
|
||||
"Foundation of data science/notes/7 Autoencoders.md",
|
||||
"Foundation of data science/images/Pasted image 20241129150041.png",
|
||||
"Foundation of data science/notes/Untitled.md",
|
||||
"Foundation of data science/images/Pasted image 20241129145900.png",
|
||||
"Pasted image 20241129145845.png",
|
||||
"Foundation of data science/notes/6 PCA.md",
|
||||
"Foundation of data science/images/Pasted image 20241129144016.png",
|
||||
"Foundation of data science/images/Pasted image 20241129144013.png",
|
||||
"Biometric Systems/images/Pasted image 20241128083519.png",
|
||||
"Biometric Systems/notes/12. Iris recognition.md",
|
||||
"Foundation of data science/slides/Untitled.md",
|
||||
"Biometric Systems/slides/LEZIONE10_Iris recognition.pdf",
|
||||
"Biometric Systems/notes/11. Fingerprints.md",
|
||||
"Biometric Systems/slides/LEZIONE11_Fingerprints.pdf",
|
||||
"Biometric Systems/images/Pasted image 20241128000533.png",
|
||||
"Biometric Systems/images/Pasted image 20241128000431.png",
|
||||
"Biometric Systems/notes/9. Ear recognition.md",
|
||||
"Biometric Systems/images/Pasted image 20241127235513.png",
|
||||
"Biometric Systems/slides/Riassunto_2021_2022.pdf",
|
||||
"Biometric Systems/slides/Biometric_System___Notes.pdf",
|
||||
"Biometric Systems/images/Pasted image 20241127233105.png",
|
||||
"Biometric Systems/images/Pasted image 20241127231119.png",
|
||||
"Biometric Systems/images/Pasted image 20241127230718.png",
|
||||
"Biometric Systems/images/Pasted image 20241127225853.png",
|
||||
"Biometric Systems/images/Pasted image 20241127224325.png",
|
||||
"Biometric Systems/images/Pasted image 20241127141648.png",
|
||||
"Biometric Systems/images/Pasted image 20241127140836.png",
|
||||
"Biometric Systems/images/Pasted image 20241128102138.png",
|
||||
"Biometric Systems/images/Pasted image 20241128101031.png",
|
||||
"Biometric Systems/notes/11. Fingerprints.md",
|
||||
"Biometric Systems/slides/LEZIONE11_Fingerprints.pdf",
|
||||
"Biometric Systems/notes/9. Ear recognition.md",
|
||||
"Biometric Systems/notes/dati da considerare.md",
|
||||
"Foundation of data science/notes/6 PCA.md",
|
||||
"Foundation of data science/slides/IP CV Basics.pdf",
|
||||
"Foundation of data science/notes/Untitled.md",
|
||||
"Foundation of data science/slides/FDS_backprop_new.pdf",
|
||||
"Foundation of data science/slides/Untitled 1.md",
|
||||
"Foundation of data science/slides/more on nn.pdf",
|
||||
|
@ -293,8 +238,6 @@
|
|||
"Autonomous Networking/notes/7.2 10 arm testbed - optimism in face of uncertainty.md",
|
||||
"Autonomous Networking/notes/9 Markov processes.md",
|
||||
"Autonomous Networking/notes/2 RFID.md",
|
||||
"Autonomous Networking/notes/6 Internet of Things.md",
|
||||
"Biometric Systems/notes/4. Face detection.md",
|
||||
"Senza nome.canvas"
|
||||
]
|
||||
}
|
BIN
Biometric Systems/images/Pasted image 20241128083519.png
Normal file
After Width: | Height: | Size: 374 KiB |
BIN
Biometric Systems/images/Pasted image 20241128090512.png
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
Biometric Systems/images/Pasted image 20241128091236.png
Normal file
After Width: | Height: | Size: 306 KiB |
BIN
Biometric Systems/images/Pasted image 20241128091305.png
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
Biometric Systems/images/Pasted image 20241128100043.png
Normal file
After Width: | Height: | Size: 225 KiB |
BIN
Biometric Systems/images/Pasted image 20241128100329.png
Normal file
After Width: | Height: | Size: 333 KiB |
BIN
Biometric Systems/images/Pasted image 20241128101031.png
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
Biometric Systems/images/Pasted image 20241128102138.png
Normal file
After Width: | Height: | Size: 239 KiB |
|
@ -1,2 +1,86 @@
|
|||
Iris texture is almost completely randotipic, that's why it's useful for recognition.
|
||||
|
||||
The iris is a muscle membrane of the eye, of variable color, with both shape and function of a diaphragm.
|
||||
- it is pigmented, located posterior to the cornea and in front of the lens, and is perforated by pupil
|
||||
- consists of a flat layer of muscle fibers which circularly surround the pupil, a thin layer of smooth muscle fibers by means of which the pupil is dilated and posteriorly by two layers of epithelial pigmented cells
|
||||
- it contains recular texture (mostly by furrows) and irrecular patterns (e.g. freckless and crypts), these combined with the color provides a very high level of discrimination, comparable to fingerprints.
|
||||
![[Pasted image 20241128083519.png]]
|
||||
|
||||
**Pros:**
|
||||
- iris is visible yet well protected
|
||||
- time invariant (after about 2 years of age)
|
||||
- extremely distinguishing trait (right different from left, even twins have different irises)
|
||||
- no direct contact required
|
||||
- acquisition via both near infrared and visible wavelenghts
|
||||
**Cons:**
|
||||
- limited iris surface (about $3.64cm^2$)
|
||||
- short distance required ($< 1m$), however it depends on the resolution of the capture device
|
||||
- limited depth of field
|
||||
- need to consider gaze direction (sguardo)
|
||||
- better if the gaze direction is the same
|
||||
- presence of glasses
|
||||
- presence of contact lenses
|
||||
- especially cosmetic lenses
|
||||
- (lens may be detected, as they may be camouflage or spoofing attempts)
|
||||
|
||||
### Iris capture modalities
|
||||
Two ways:
|
||||
- **Visible light:**
|
||||
- melanin absorbs visible light
|
||||
- layers that make up the iris are well visible
|
||||
- however, the image contains noisy information (such as reflections)
|
||||
- but areas with reflections can be ignored in matching
|
||||
- **Infrared light:**
|
||||
- melanin reflects most of the infrared light
|
||||
- texture is more visible
|
||||
- best suited in biometric systems based on iris recognition
|
||||
- however, special equipment is required
|
||||
![[Pasted image 20241128090512.png]]
|
||||
|
||||
### Processing phases
|
||||
- The presence of noisy elements requires a good pre-processing/segmentation
|
||||
- we don't want to process the pupil
|
||||
![[Pasted image 20241128091236.png]]
|
||||
The inner contour of the eye may change on illumination changes as pupil dilates. Normalization tries to make templates comparable (wit the same size). Then we have the coding fase, that extracts useful information.
|
||||
|
||||
##### John Daugman approach (the most famous)
|
||||
![[Pasted image 20241128091305.png]]
|
||||
- strictly near infrared
|
||||
|
||||
- uses a kind of circular edge detector to localize both the pupil and the iris
|
||||
- exploits the convolution of the image with a Gaussian smoothing function with center $r_{0}$ and standard deviation $\sigma$
|
||||
- the operator looks for a circular path along which pixel variation is maximized, by varying the center $r$ and radius $(x0, y0)$ of a candidate circular contour
|
||||
- when the candidate circle has the same radius and center of the iris, the operator should provide a peak
|
||||
![[Pasted image 20241128100043.png|300]]
|
||||
|
||||
|
||||
- similar procedure for looking at eyelids, but instead of looking cor circular paths the operator looks for archs, which are approximated by splines
|
||||
![[Pasted image 20241128100329.png|300]]
|
||||
|
||||
- at the end, we obtain a mask (so that only iris pixels are processed)
|
||||
##### Unwrapping
|
||||
- we can now use an unwrapping algorithm
|
||||
- simple with polar coordinates (circular bands become horizontal stripes)
|
||||
- it is important to detect the right centre for the polar coordinates
|
||||
- but pupil and iris are not perfectly concentric!
|
||||
- size of the pupil can change!
|
||||
- gaze direction can change the relative position of sclera, iris and pupil
|
||||
- a normalization procedure is necessary: Rubber Sheet Model
|
||||
![[Pasted image 20241128101031.png]]
|
||||
|
||||
##### Rubber Sheet Model
|
||||
- maps each iris point onto polar coordinates $(r, \theta)$ with $r \in [0, 1]$ and $\theta \in [0, 2\pi]$
|
||||
- the model compensates for pupil dilation and size variation by producing a invariant representation
|
||||
- does not compensate for rotations. But it is done during matching by translating the templates until alignment
|
||||
- see slides for the formulas
|
||||
|
||||
##### Daugman: Feature extraction
|
||||
- Gabor filters to the image in polar coordinates (formula on slide)
|
||||
- for each element with coordinates $(r, \theta)$ in the image $I(\rho, \phi)$, the method computes a pair of bits
|
||||
- ... are discretized to obtain a 256 byte code, plus a mask of the same size to identify valid iris elements
|
||||
...complete with slides...
|
||||
|
||||
![[Pasted image 20241128102138.png]]
|
||||
|
||||
### NICE competition
|
||||
cose
|
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 104 KiB |
101
Foundation of data science/notes/7 Autoencoders.md
Normal file
|
@ -0,0 +1,101 @@
|
|||
video consigliato prima di leggere: https://www.youtube.com/watch?v=hZ4a4NgM3u0
|
||||
|
||||
Un autoencoder è una rete neurale feed-forward: ![[Pasted image 20241129142615.png]]
|
||||
|
||||
L'obiettivo di un autoencoder è ricostruire esattamente l'input x (prende x in input e restituisce una cosa molto simile ad x in output, che chiameremo $x_{hat}$).
|
||||
|
||||
Nell'immagine, l'hidden layer ha una dimensionalità decisamente inferiore rispetto all'input. Questo costringe il modello ad imparare le feature principali dall'input, per poterlo ricostruire nel modo più simile possibile.
|
||||
Quell'hidden layer viene detto *latent space*.
|
||||
|
||||
L'errore nella ricostruzione $x_{hat}$ di $x$ è il classico Mean Squared Error (MSE), che useremo come loss function.
|
||||
|
||||
**Questa roba si può usare per tante cose:**
|
||||
- si può usare per estrarre feature (un po' come fa il PCA), in questo caso dopo il training mi interessa considerare la parte di encoding
|
||||
- nei modelli generativi viene invece usata anche parte di decoding, ad esempio un possibile utilizzo è un modello che rimuove il rumore dalle immagini: imparerà ad estrarre i pattern importanti dell'immagine (non il rumore), e poi sulla base di questi ricostruire un'immagine più clean.
|
||||
|
||||
**Possibili impieghi:**
|
||||
- riduzione della dimensionalità
|
||||
- compressione dei dati mantenendo le informazioni importanti
|
||||
- imparare feature per altri task
|
||||
- utilizzare dati senza label: il training è unsupervised, non servono label. Ci sono scenari in cui non si hanno a disposizione le label, o magari le si hanno solo per un piccolo sottoinsieme dei dati. In quest'ultimo caso posso fare un training iniziale con un autoencoder, poi sostituisco il decoder con dei layer di classificazione (es. linear layer + softmax) e faccio fine tuning con i dati con label a disposizione.
|
||||
|
||||
#### Autoencoder lineari
|
||||
- un solo hidden layer, con activation function lineari
|
||||
- possiamo esprimere $x_{hat}$ come una trasformazione lineare di $x$
|
||||
![[Pasted image 20241129144016.png|300]]
|
||||
$x_{hat} = UVx$
|
||||
|
||||
Hey, sembra molto simile al PCA questa cosa...
|
||||
Esatto, perché questo è letteralmente il PCA! Se invece di fare training utilizziamo PCA, V (la matrice dei pesi del layer di encoding) non sarà altro che l'autovettore del PCA. U (matrice di pesi del layer di decoding) sarà la trasposta di V.
|
||||
|
||||
#### Eigenfaces
|
||||
Le eigenfaces sono le componenti principali di un grosso insieme di facce (immagini di volti), e possono essere usate in task di face recognition. **Come?**
|
||||
- si appiattiscono le facce, passando da 2D a 1D (classico flattening di una matrice)
|
||||
- si centrano tutte le facce
|
||||
- si calcola il valore medio di tutte le facce e lo si sottrae a ogni faccia, in modo che i dati siano centrati attorno lo zero. Praticamente è una normalizzazione, ma "normalizziamo solo la media" e non la varianza
|
||||
- si applica PCA all'insieme di facce e si tengono le $k$ facce che catturano la maggior parte della varianza. Gli autovettori che otterremo si chiamano *eigenfaces*
|
||||
- qualsiasi faccia può essere rappresentata come combinazione lineare di queste eigenfaces
|
||||
- per vedere se due facce sono simili mi basterà usare una metrica di distanza tipo la distanza euclidea, o la cosine similarity ecc.
|
||||
|
||||
**Limitazioni:**
|
||||
- sensibile a variazioni PIE
|
||||
- il dataset di train deve includere molta diversità
|
||||
- non riesce a catturare le variazioni non lineari di una faccia, dal momento che PCA è lineare!
|
||||
#### Deep autoencoders
|
||||
Ecco, ora arriva la parte interessante.
|
||||
Invece di proiettare i dati su un sottospazio, i deep autoencoders lo fanno su un manifold non lineare:
|
||||
![[Pasted image 20241129145900.png|300]]
|
||||
|
||||
#### Stacked autoencoders
|
||||
Si possono usare più layer di encoding? Certo!
|
||||
![[Pasted image 20241129150041.png|500]]
|
||||
|
||||
E non solo... Posso anche semplificare il training trainando un pezzettino per volta:
|
||||
![[Pasted image 20241129150144.png|500]]
|
||||
|
||||
#### Dimensione hidden layer
|
||||
**Undercomplete autoencoders:**
|
||||
- quelli la cui dimensione degli hidden layer è inferiore alla dimensione di input e output
|
||||
- riduzione dimensionalità (il latent space ha dimensionalità minore appunto)
|
||||
- forza il modello a imparare rappresentazioni sensate dei dati, assicurandosi che non vada semplicemente a memorizzarli
|
||||
- ma potrebbe perdere informazioni utili se i dati in input sono molto complessi o la loro dimensionalità è alta
|
||||
|
||||
**Overcomplete autoencoders:**
|
||||
- l'opposto, letteralmente. Gli hidden layers sono più grandi
|
||||
- può catturare una rappresentazione più ricca dei dati
|
||||
- ma... senza opportuni vincoli, memorizzerà i dati in input e basta :/
|
||||
- La soluzione sono gli sparse autoencoders, che introducono vincoli.
|
||||
|
||||
#### Sparse autoencoders
|
||||
Si vuole aggiungere un vincolo che forza l'attivazione solo di alcuni neuroni per volta.
|
||||
- Aiuta a ottenere rappresentazioni più interpretabili, in cui ogni neurone rappresenta una caratteristica specifica.
|
||||
- Riduce il rischio di **overfitting**, poiché forza il modello a rappresentare i dati in modo più compatto.
|
||||
- È ispirato al funzionamento biologico del cervello, dove solo poche regioni neurali si attivano contemporaneamente.
|
||||
|
||||
Come? Introducendo un meccanismo di penalizzazione, per cui la loss diventerà: $$L = ||X - \hat{X}||^2 + \lambda \cdot \text{Penalty}(s)$$
|
||||
Si possono usare due penalty mechanism:
|
||||
##### Regolarizzazione L1
|
||||
La regolarizzazione L1 penalizza direttamente i valori assoluti delle attivazioni dell'hidden layer aggiungendo un termine proporzionale alla loro somma nella loss function. In pratica, incoraggia molte attivazioni a essere esattamente **zero**, ottenendo una rappresentazione più sparsa.
|
||||
La loss function sarà:
|
||||
$$L = \text{MSE} + \lambda \sum_{i,j} |z_j^{(i)}|$$
|
||||
Dove $z_{j}^i$ è il valore di attivazione del neurone j per il campione i
|
||||
(p.s. per attivazione si intende il valore numerico prodotto in output dal neurone)
|
||||
|
||||
##### KL Divergence
|
||||
La **KL Divergence** misura la "distanza" tra due distribuzioni di probabilità. Negli sparse autoencoders, viene utilizzata per confrontare la distribuzione delle attivazioni dei neuroni nell'hidden layer con una distribuzione desiderata che promuova la sparsità.
|
||||
|
||||
Ad esempio, se sceglo di avere una sparsità di 0.05
|
||||
|
||||
$$KL(ρ∣∣a^j)=rhologρa^j+(1−ρ)log1−ρ1−a^jKL(\rho || \hat{a}_j) = \rho \log \frac{\rho}{\hat{a}_j} + (1 - \rho) \log \frac{1 - \rho}{1 - \hat{a}_j}$$
|
||||
- $\rho$: valore desiderato di sparsità (es. 0.05).
|
||||
- $\hat{a}_j$: attivazione media del neurone jj calcolata su tutto il dataset.
|
||||
|
||||
In questo modo penalizziamo sia i neuroni che si attivano troppo, sia quelli che si attivano troppo poco. Questo forza l'autoencoder a trovare rappresentazioni latenti che coinvolgano pochi neuroni attivi, garantendo una maggiore efficienza e interpretabilità.
|
||||
|
||||
- **Vantaggi**:
|
||||
- Rende le rappresentazioni più interpretabili.
|
||||
- Riduce il rischio di overfitting.
|
||||
- Può aiutare nella separazione delle caratteristiche nei dati.
|
||||
- **Considerazioni**:
|
||||
- La scelta di ρ e β è cruciale: valori troppo grandi possono rendere il training instabile.
|
||||
- La penalizzazione introdotta dalla KL Divergence può rendere l'ottimizzazione più lenta.
|