kcai-data-sampling 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kcai_data_sampling-0.0.3/PKG-INFO +83 -0
- kcai_data_sampling-0.0.3/README.md +51 -0
- kcai_data_sampling-0.0.3/pyproject.toml +31 -0
- kcai_data_sampling-0.0.3/requirements.txt +25 -0
- kcai_data_sampling-0.0.3/setup.cfg +4 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling/__init__.py +9 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling/adversarial_run.py +524 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling/augment_run.py +807 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling/kc_inference.py +357 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling/run_augment_pipeline.py +658 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling.egg-info/PKG-INFO +83 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling.egg-info/SOURCES.txt +13 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling.egg-info/dependency_links.txt +1 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling.egg-info/requires.txt +23 -0
- kcai_data_sampling-0.0.3/src/kcai_data_sampling.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kcai-data-sampling
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: Samples generation utilities managed with uv
|
|
5
|
+
Author-email: Safenai <support@safenai.io>, IRT SystemX <support@irt-systemx.fr>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: pyarrow>=10.0.0
|
|
10
|
+
Requires-Dist: numpy>=1.20.0
|
|
11
|
+
Requires-Dist: pillow>=8.0.0
|
|
12
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
13
|
+
Requires-Dist: torch>=1.10.0
|
|
14
|
+
Requires-Dist: ipykernel>=6.29.5
|
|
15
|
+
Requires-Dist: torchvision>=0.20.1
|
|
16
|
+
Requires-Dist: torch==2.5.1
|
|
17
|
+
Requires-Dist: torchvision==0.20.1
|
|
18
|
+
Requires-Dist: captum==0.7.0
|
|
19
|
+
Requires-Dist: torch_pruning==1.3.7
|
|
20
|
+
Requires-Dist: tqdm==4.66.5
|
|
21
|
+
Requires-Dist: click==8.1.7
|
|
22
|
+
Requires-Dist: pyyaml
|
|
23
|
+
Requires-Dist: numpy<2
|
|
24
|
+
Requires-Dist: neural-compressor==3.1.1
|
|
25
|
+
Requires-Dist: thop
|
|
26
|
+
Requires-Dist: tabulate
|
|
27
|
+
Requires-Dist: pyarrow==17.0.0
|
|
28
|
+
Requires-Dist: albumentations>=2.0.8
|
|
29
|
+
Requires-Dist: autoattack==0.5.5
|
|
30
|
+
Requires-Dist: cleverhans==4.1.0
|
|
31
|
+
Requires-Dist: boto3>=1.40.51
|
|
32
|
+
|
|
33
|
+
# KC-DATA-SAMPLING
|
|
34
|
+
|
|
35
|
+
## Installation rapide
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv venv .venv
|
|
39
|
+
source .venv/bin/activate
|
|
40
|
+
uv sync
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Lancement
|
|
44
|
+
|
|
45
|
+
### 1. Génération d'images augmentées et adversariales
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Images corrompues (augmentations)
|
|
49
|
+
python augment_run.py --config examples/augment_all.yml
|
|
50
|
+
|
|
51
|
+
# Images adversariales (FGSM, PGD, C&W, APGD)
|
|
52
|
+
python adversarial_run.py --config examples/adversarial_fgsm.yml
|
|
53
|
+
python adversarial_run.py --config examples/adversarial_all.yml
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Note**: Ces scripts génèrent maintenant les images **sans inférence**. Les colonnes générées sont :
|
|
57
|
+
- `sample_uuid` (nouveau UUID unique)
|
|
58
|
+
- `parent_sample_uuid` (lien vers l'échantillon d'origine)
|
|
59
|
+
- `image_hash` (hash SHA256)
|
|
60
|
+
- `sample_id`, `sample_type`, `class_id`, `class_name`, `split`
|
|
61
|
+
- `transform_id`, `transform_name`, `transform_level`, `transform_params`
|
|
62
|
+
- `image_bytes`
|
|
63
|
+
|
|
64
|
+
### 2. Inférence sur les images
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Inférence de base (garde toutes les colonnes + ajoute prédictions)
|
|
68
|
+
python kc_inference.py --config examples/kc_inference.yaml
|
|
69
|
+
|
|
70
|
+
# mode in-place (onmodifie le fichier directement)
|
|
71
|
+
python kc_inference.py --config examples/kc_inference.yaml --in-place
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Options d'inférence disponibles :
|
|
75
|
+
|
|
76
|
+
**Modes de sortie** :
|
|
77
|
+
- `label_only` : Seulement le label prédit
|
|
78
|
+
- `label_prob` : Label + probabilité
|
|
79
|
+
- `top_k` : Label + prob + top-K labels et probs
|
|
80
|
+
- `all_probs` : Label + prob + toutes les probabilités
|
|
81
|
+
- `logits` : Label + prob + logits
|
|
82
|
+
- `extended` : Label + prob + all_probs + logits (recommandé)
|
|
83
|
+
- `full` : Tout (label + prob + top_k + all_probs + logits)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# KC-DATA-SAMPLING
|
|
2
|
+
|
|
3
|
+
## Installation rapide
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
uv venv .venv
|
|
7
|
+
source .venv/bin/activate
|
|
8
|
+
uv sync
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Lancement
|
|
12
|
+
|
|
13
|
+
### 1. Génération d'images augmentées et adversariales
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Images corrompues (augmentations)
|
|
17
|
+
python augment_run.py --config examples/augment_all.yml
|
|
18
|
+
|
|
19
|
+
# Images adversariales (FGSM, PGD, C&W, APGD)
|
|
20
|
+
python adversarial_run.py --config examples/adversarial_fgsm.yml
|
|
21
|
+
python adversarial_run.py --config examples/adversarial_all.yml
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Note**: Ces scripts génèrent maintenant les images **sans inférence**. Les colonnes générées sont :
|
|
25
|
+
- `sample_uuid` (nouveau UUID unique)
|
|
26
|
+
- `parent_sample_uuid` (lien vers l'échantillon d'origine)
|
|
27
|
+
- `image_hash` (hash SHA256)
|
|
28
|
+
- `sample_id`, `sample_type`, `class_id`, `class_name`, `split`
|
|
29
|
+
- `transform_id`, `transform_name`, `transform_level`, `transform_params`
|
|
30
|
+
- `image_bytes`
|
|
31
|
+
|
|
32
|
+
### 2. Inférence sur les images
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Inférence de base (garde toutes les colonnes + ajoute prédictions)
|
|
36
|
+
python kc_inference.py --config examples/kc_inference.yaml
|
|
37
|
+
|
|
38
|
+
# mode in-place (onmodifie le fichier directement)
|
|
39
|
+
python kc_inference.py --config examples/kc_inference.yaml --in-place
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### Options d'inférence disponibles :
|
|
43
|
+
|
|
44
|
+
**Modes de sortie** :
|
|
45
|
+
- `label_only` : Seulement le label prédit
|
|
46
|
+
- `label_prob` : Label + probabilité
|
|
47
|
+
- `top_k` : Label + prob + top-K labels et probs
|
|
48
|
+
- `all_probs` : Label + prob + toutes les probabilités
|
|
49
|
+
- `logits` : Label + prob + logits
|
|
50
|
+
- `extended` : Label + prob + all_probs + logits (recommandé)
|
|
51
|
+
- `full` : Tout (label + prob + top_k + all_probs + logits)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=80", "setuptools-scm[simple]>=8"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kcai-data-sampling"
|
|
7
|
+
version = "0.0.3"
|
|
8
|
+
description = "Samples generation utilities managed with uv"
|
|
9
|
+
dynamic = ["dependencies"] #, "version"]
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Safenai", email="support@safenai.io"},
|
|
12
|
+
{name = "IRT SystemX", email="support@irt-systemx.fr"},
|
|
13
|
+
]
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.11"
|
|
16
|
+
license ="Apache-2.0"
|
|
17
|
+
|
|
18
|
+
[tool.pytest.ini_options]
|
|
19
|
+
addopts = "-q"
|
|
20
|
+
|
|
21
|
+
[tool.ruff]
|
|
22
|
+
line-length = 100
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.dynamic]
|
|
26
|
+
dependencies = {file = ["requirements.txt"]}
|
|
27
|
+
|
|
28
|
+
[tool.setuptools_scm]
|
|
29
|
+
version_file = "src/kcai_data_sampling/_version_.py"
|
|
30
|
+
root= "../.."
|
|
31
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Main dependencies for kc-dataset
|
|
2
|
+
pyarrow>=10.0.0
|
|
3
|
+
numpy>=1.20.0
|
|
4
|
+
pillow>=8.0.0
|
|
5
|
+
scikit-learn>=1.0.0
|
|
6
|
+
torch>=1.10.0
|
|
7
|
+
ipykernel>=6.29.5
|
|
8
|
+
torchvision>=0.20.1
|
|
9
|
+
|
|
10
|
+
torch==2.5.1
|
|
11
|
+
torchvision==0.20.1
|
|
12
|
+
captum==0.7.0
|
|
13
|
+
torch_pruning==1.3.7
|
|
14
|
+
tqdm==4.66.5
|
|
15
|
+
click==8.1.7
|
|
16
|
+
pyyaml
|
|
17
|
+
numpy<2
|
|
18
|
+
neural-compressor==3.1.1
|
|
19
|
+
thop
|
|
20
|
+
tabulate
|
|
21
|
+
pyarrow==17.0.0
|
|
22
|
+
albumentations>=2.0.8
|
|
23
|
+
autoattack==0.5.5
|
|
24
|
+
cleverhans==4.1.0
|
|
25
|
+
boto3>=1.40.51
|