Machine Learning project - University of Bologna (a.y. 2024-25)
Deep learning neural network for swirl detection and analysis using U-Net architecture.
This project implements a neural network (U-Net) for detecting image manipulations with swirl effects applied at variable positions, intensity and sizes. The network returns a binary mask that localizes the defected regions.
Achieved Results: Mean IoU of 0.9146 ± 0.0134 on test set
The model uses an optimized U-Net architecture tailored for this task:
Input: 128×128×3
↓
Encoder:
- ConvBlock(16) → MaxPool
- ConvBlock(32) → MaxPool
- ConvBlock(64) → MaxPool
↓
Bottleneck:
- SeparableConv2D(1×1, 3×3, 5×5) × 2
↓
Decoder:
- UpConv(64) + Skip → ConvBlock
- UpConv(32) + Skip → ConvBlock
- UpConv(16) + Skip → ConvBlock
↓
Output: Conv2D(1, sigmoid) → 128×128×1| Property | Value |
|---|---|
| Source | TensorFlow Flowers dataset |
| Split | 3000 train / 300 validation / 370 test |
| Resolution | 128×128×3 pixels |
| Parameter | Value |
|---|---|
| Max radius | 32 pixels |
| Max strength | 4 |
| Center | Random position |
| Parameter | Value |
|---|---|
| Epochs | 70 (50 + 20 additional) |
| Batch size | 32 |
| Optimizer | Adam |
| Loss function | Dice Loss |
| Metric | Value |
|---|---|
| Test Mean IoU | 0.9146 ± 0.0134 |
| Val Mean IoU Peak | 0.9511 (epoch 61 of 70) |
| Total Parameters | 585,073 |
tensorflow>=2.8.0
scikit-image>=0.19.0
matplotlib>=3.5.0
numpy>=1.21.0
tensorflow-datasets>=4.6.0git clone <repository-url>
cd SwirlDetection
pip install -r requirements.txt
jupyter notebook SwirlDetection.ipynb