Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ff34cde
feat: gaussian noiose unit tests
mGarbowski Nov 8, 2025
adf94d6
feat: gaussian noise aug proper tests
mGarbowski Nov 8, 2025
1a0dd00
feat: script for downloading shape predictor weights
mGarbowski Nov 8, 2025
ecc7c58
feat: AddGlassesAugmentation test, refactor gaussian noise pil test
mGarbowski Nov 8, 2025
dfeb67d
feat: AddMaskAugmentation test
mGarbowski Nov 8, 2025
0c00259
feat: random rectangle aug test
mGarbowski Nov 8, 2025
6c78a32
feat: add just script for connecting to vpn
mGarbowski Nov 8, 2025
b3c0924
feat: add tests for FacePairsBenchmnark
mGarbowski Nov 8, 2025
9539b1e
fix: disable multiprocessing in test to avoid warnings
mGarbowski Nov 8, 2025
a1e7c6d
feat: tests for rococo evaluation adapter
mGarbowski Nov 8, 2025
de48df4
feat: add just script for downloading opencv detector weights
mGarbowski Nov 8, 2025
a39bed1
feat: move functions from script to library
mGarbowski Nov 8, 2025
4063900
feat: add video processor test
mGarbowski Nov 8, 2025
625bbfe
feat: add test for fine tuning trainer
mGarbowski Nov 8, 2025
491cd1d
chore: formatting
mGarbowski Nov 8, 2025
e13573a
chore: merge benchmark and evaluation packages
mGarbowski Nov 8, 2025
29a1311
chore: dataset package init and cleanup imports
mGarbowski Nov 8, 2025
c1d1a7a
chore: cleanup imports
mGarbowski Nov 8, 2025
ca80287
chore: rename utils to common, move models to common
mGarbowski Nov 8, 2025
cffb1dc
chore: make augmenation a subpackage of training
mGarbowski Nov 8, 2025
b2e73d2
chore: make loss a subpackage of training
mGarbowski Nov 8, 2025
08eaeec
chore: fine tuning package init and relative imports
mGarbowski Nov 8, 2025
f3ac0d0
chore: script package imports
mGarbowski Nov 8, 2025
b033c34
feat: update mkdocs config
mGarbowski Nov 8, 2025
9e73654
feat: remove doorstop from project
mGarbowski Nov 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy MkDocs and Doorstop to GitHub Pages
name: Deploy MkDocs to GitHub Pages

on:
push:
Expand All @@ -7,7 +7,6 @@ on:
paths:
- 'src/**'
- 'docs/mkdocs/**'
- 'docs/doorstop/**'
workflow_dispatch:

jobs:
Expand All @@ -25,11 +24,7 @@ jobs:

- name: Install dependencies
run: |
pip install mkdocs mkdocs-material mkdocstrings[python] doorstop

- name: Generate Doorstop HTML
run: |
doorstop publish all docs/mkdocs/doorstop
pip install mkdocs mkdocs-material mkdocstrings[python]

- name: Build and deploy MkDocs
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ __pycache__
.env
wandb
.wandb
results
results
wireguard
25 changes: 20 additions & 5 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ default:
install:
uv sync

# Connect to VPN
vpn_connect:
sudo wg-quick up wg0

# Disconnect from VPN
vpn_disconnect:
sudo wg-quick down wg0

# Download shape predictor model weights
download_shape_predictor:
mkdir -p models/dlib
wget -O models/dlib/shape_predictor_68_face_landmarks.dat.bz2 https://raw.githubusercontent.com/davisking/dlib-models/master/shape_predictor_68_face_landmarks.dat.bz2
bzip2 -d models/dlib/shape_predictor_68_face_landmarks.dat.bz2

# Download opencv face detector model weights
download_opencv_face_detector:
mkdir -p models/opencv
wget -O models/opencv/haarcascade_frontalface_default.xml https://raw.githubusercontent.com/opencv/opencv/4.x/data/haarcascades/haarcascade_frontalface_default.xml

# === Scripts from src.scripts package ===

# Run benchmark
Expand Down Expand Up @@ -36,7 +55,7 @@ test:

# Run tests with coverage
cov:
uv run pytest --cov=src
uv run pytest --cov=src --cov-report=term-missing

# === Static Analysis ===

Expand Down Expand Up @@ -93,10 +112,6 @@ metrics_all: metrics_raw_src metrics_raw_tests metrics_raw_notebooks metrics_cyc

# === Documentation ===

# Build doorstop documentation
doorstop_build:
uv run doorstop publish all site/doorstop

# Serve documentation locally
docs:
uv run mkdocs serve
Expand Down
5 changes: 0 additions & 5 deletions docs/doorstop/WF/.doorstop.yml

This file was deleted.

10 changes: 0 additions & 10 deletions docs/doorstop/WF/WF001.yml

This file was deleted.

6 changes: 0 additions & 6 deletions docs/doorstop/WT/.doorstop.yml

This file was deleted.

12 changes: 0 additions & 12 deletions docs/doorstop/WT/WT001.yml

This file was deleted.

3 changes: 0 additions & 3 deletions docs/mkdocs/api/augmentation.md

This file was deleted.

3 changes: 3 additions & 0 deletions docs/mkdocs/api/common.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Common

::: src.common
3 changes: 3 additions & 0 deletions docs/mkdocs/api/evaluation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Evaluation

::: src.evaluation
3 changes: 0 additions & 3 deletions docs/mkdocs/api/loss.md

This file was deleted.

3 changes: 3 additions & 0 deletions docs/mkdocs/api/plots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Plots

::: src.plots
3 changes: 3 additions & 0 deletions docs/mkdocs/api/scripts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Scripts

::: src.scripts
5 changes: 5 additions & 0 deletions docs/mkdocs/api/training.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Training

::: src.training
options:
show_submodules: true
3 changes: 0 additions & 3 deletions docs/mkdocs/api/validation.md

This file was deleted.

3 changes: 3 additions & 0 deletions docs/mkdocs/api/video_processing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Video Processing

::: src.video_processing
4 changes: 2 additions & 2 deletions docs/mkdocs/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Dokumentacja projektu
# Project documentation

Wygenerowana przy pomocy MkDocs
Generated with MkDocs.
14 changes: 8 additions & 6 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site_name: "Dokumentacja projektu"
site_name: "Project documentation"
docs_dir: "docs/mkdocs"
theme:
name: "material"
Expand All @@ -21,9 +21,11 @@ plugins:
show_function_docstring: true
nav:
- Home: index.md
- API:
- Augmentation: api/augmentation.md
- API Reference:
- Common: api/common.md
- Dataset: api/dataset.md
- Loss: api/loss.md
- Validation: api/validation.md
- Wymagania: doorstop/index.html
- Evaluation: api/evaluation.md
- Plots: api/plots.md
- Scripts: api/scripts.md
- Training: api/training.md
- Video Processing: api/video_processing.md
6 changes: 3 additions & 3 deletions notebooks/04-fine_tuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
"from torchvision import transforms\n",
"from torchvision.utils import make_grid\n",
"\n",
"from src.augmentation.mask import GenerateMask\n",
"from src.augmentation.random_rectangle import (\n",
"from src.training.augmentation import GenerateMask\n",
"from src.training.augmentation.random_rectangle import (\n",
" AddRandomRectangleAverageColor,\n",
" AddRandomRectangleRandomColor,\n",
" AddRandomBlackRectangle,\n",
")\n",
"from src.dataset.lfw import LFWDataset\n",
"from src.dataset.rof import ROFDataset\n",
"from src.loss.contrastive_loss import ContrastiveLoss"
"from src.training.loss import ContrastiveLoss"
],
"id": "8d8ee930d7320f79",
"outputs": [],
Expand Down
2 changes: 1 addition & 1 deletion notebooks/07-face_landmark_based_augmentation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"\n",
"os.chdir(\"..\")\n",
"\n",
"from src.augmentation import AddMaskAugmentation\n",
"from src.training.augmentation import AddMaskAugmentation\n",
"\n",
"os.getcwd()"
]
Expand Down
4 changes: 2 additions & 2 deletions notebooks/08-glasses-augmentation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"\n",
"os.chdir(\"..\")\n",
"\n",
"from src.training.data_loaders import get_lfw_loaders\n",
"from src.augmentation import AddGlassesAugmentation\n",
"from src.dataset.data_loaders import get_lfw_loaders\n",
"from src.training.augmentation import AddGlassesAugmentation\n",
"\n",
"os.getcwd()"
]
Expand Down
2 changes: 1 addition & 1 deletion notebooks/09-all-augmentations-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"\n",
"os.chdir(\"..\")\n",
"\n",
"from src.augmentation import get_augmentation_transform\n",
"from src.training.augmentation import get_augmentation_transform\n",
"\n",
"os.getcwd()"
]
Expand Down
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ profile = "black"

[tool.pytest.ini_options]
pythonpath = ["src"]
markers = [
"integration: integration tests that may require external resources (e.g. model weights)",
]
filterwarnings = [
"ignore::pydantic._internal._generate_schema.UnsupportedFieldAttributeWarning", # Ignore warning from libraries
]

[dependency-groups]
dev = [
Expand All @@ -43,7 +49,6 @@ dev = [
"mkdocs>=1.6.1",
"mkdocstrings[python]>=0.29.1",
"mkdocs-material>=9.6.13",
"doorstop>=3.0",
"pytest-cov>=6.1.1",
]

Expand Down
11 changes: 0 additions & 11 deletions src/benchmark/__init__.py

This file was deleted.

15 changes: 15 additions & 0 deletions src/common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from .config import default_device_str
from .models import (
get_dlib_frontal_face_detector,
get_dlib_shape_predictor,
get_facenet_pytorch_inception_resnet_v1,
get_facenet_pytorch_mtcnn_detector,
)

__all__ = [
"default_device_str",
"get_facenet_pytorch_inception_resnet_v1",
"get_facenet_pytorch_mtcnn_detector",
"get_dlib_frontal_face_detector",
"get_dlib_shape_predictor",
]
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions src/dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from .data_loaders import (
get_dummy_loaders,
get_lfw_loaders,
get_rococo_loaders,
)
from .dummy import DummyFacePairsDataset
from .face_pairs import FacePairsDataset
from .lfw import LFWDataset
from .rococo_training import RococoTrainingDataset
from .rof import ROFDataset

__all__ = [
"get_lfw_loaders",
"get_rococo_loaders",
"get_dummy_loaders",
"DummyFacePairsDataset",
"FacePairsDataset",
"LFWDataset",
"RococoTrainingDataset",
"ROFDataset",
]
37 changes: 34 additions & 3 deletions src/training/data_loaders.py → src/dataset/data_loaders.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from torch.utils.data import DataLoader

from src.dataset.lfw import LFWDataset
from src.dataset.rococo_training import RococoTrainingDataset
from .dummy import DummyFacePairsDataset
from .lfw import LFWDataset
from .rococo_training import RococoTrainingDataset


def get_lfw_loaders(
Expand Down Expand Up @@ -58,7 +59,6 @@ def get_rococo_loaders(
num_workers=4,
pin_memory=True,
) -> dict[str, DataLoader]:

train_set = RococoTrainingDataset.from_match_and_mismatch_pairs(
root_dir=rococo_root,
match_pairs_file="data/rococo2v3-dev/train_match_pairs.csv",
Expand Down Expand Up @@ -99,3 +99,34 @@ def get_rococo_loaders(
"train": train_loader,
"val": val_loader,
}


def get_dummy_loaders(
transform,
batch_size=32,
num_workers=0,
pin_memory=False,
) -> dict[str, DataLoader]:
train_set = DummyFacePairsDataset(transform)
val_set = DummyFacePairsDataset(transform)

train_loader = DataLoader(
train_set,
batch_size=batch_size,
shuffle=False,
num_workers=num_workers,
pin_memory=pin_memory,
)

val_loader = DataLoader(
val_set,
batch_size=batch_size,
shuffle=False,
num_workers=num_workers,
pin_memory=pin_memory,
)

return {
"train": train_loader,
"val": val_loader,
}
Loading
Loading