Spaces:
Sleeping
Sleeping
functionNormally Claude Sonnet 4.6 commited on
Commit ·
e8074db
1
Parent(s): 7ceea37
Restaurer les paramètres CNN qui fonctionnaient + epoch max à 50
Browse files- data_utils.py : augmentation revenue à Resize + flip + rotation 5°
- train_utils.py : batch_size par défaut 16 (était 32)
- app.py : dropout 0.4, batch 16, epochs max 50
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- app.py +3 -3
- data_utils.py +1 -5
- train_utils.py +1 -1
app.py
CHANGED
|
@@ -260,7 +260,7 @@ with gr.Blocks(title="Classification d’images microscopiques") as demo:
|
|
| 260 |
dropout = gr.Slider(
|
| 261 |
minimum=0.0,
|
| 262 |
maximum=0.8,
|
| 263 |
-
value=0.
|
| 264 |
step=0.05,
|
| 265 |
label="Dropout",
|
| 266 |
)
|
|
@@ -283,13 +283,13 @@ with gr.Blocks(title="Classification d’images microscopiques") as demo:
|
|
| 283 |
|
| 284 |
batch_size = gr.Dropdown(
|
| 285 |
choices=[8, 16, 32, 64],
|
| 286 |
-
value=
|
| 287 |
label="Taille du batch",
|
| 288 |
)
|
| 289 |
|
| 290 |
epochs = gr.Slider(
|
| 291 |
minimum=1,
|
| 292 |
-
maximum=
|
| 293 |
value=30,
|
| 294 |
step=1,
|
| 295 |
label="Nombre d’époques",
|
|
|
|
| 260 |
dropout = gr.Slider(
|
| 261 |
minimum=0.0,
|
| 262 |
maximum=0.8,
|
| 263 |
+
value=0.4,
|
| 264 |
step=0.05,
|
| 265 |
label="Dropout",
|
| 266 |
)
|
|
|
|
| 283 |
|
| 284 |
batch_size = gr.Dropdown(
|
| 285 |
choices=[8, 16, 32, 64],
|
| 286 |
+
value=16,
|
| 287 |
label="Taille du batch",
|
| 288 |
)
|
| 289 |
|
| 290 |
epochs = gr.Slider(
|
| 291 |
minimum=1,
|
| 292 |
+
maximum=50,
|
| 293 |
value=30,
|
| 294 |
step=1,
|
| 295 |
label="Nombre d’époques",
|
data_utils.py
CHANGED
|
@@ -44,14 +44,10 @@ class HFDatasetWrapper(Dataset):
|
|
| 44 |
def get_train_transform():
|
| 45 |
return transforms.Compose(
|
| 46 |
[
|
| 47 |
-
# Resize fixe : préserve l'échelle des textures microscopiques
|
| 48 |
transforms.Resize((IMAGE_SIZE, IMAGE_SIZE)),
|
| 49 |
transforms.RandomHorizontalFlip(p=0.5),
|
| 50 |
transforms.RandomVerticalFlip(p=0.5),
|
| 51 |
-
|
| 52 |
-
transforms.RandomRotation(degrees=15),
|
| 53 |
-
# Légère variation photométrique pour robustesse aux conditions d'acquisition
|
| 54 |
-
transforms.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.1),
|
| 55 |
transforms.ToTensor(),
|
| 56 |
transforms.Normalize(
|
| 57 |
mean=(0.485, 0.456, 0.406),
|
|
|
|
| 44 |
def get_train_transform():
|
| 45 |
return transforms.Compose(
|
| 46 |
[
|
|
|
|
| 47 |
transforms.Resize((IMAGE_SIZE, IMAGE_SIZE)),
|
| 48 |
transforms.RandomHorizontalFlip(p=0.5),
|
| 49 |
transforms.RandomVerticalFlip(p=0.5),
|
| 50 |
+
transforms.RandomRotation(degrees=5),
|
|
|
|
|
|
|
|
|
|
| 51 |
transforms.ToTensor(),
|
| 52 |
transforms.Normalize(
|
| 53 |
mean=(0.485, 0.456, 0.406),
|
train_utils.py
CHANGED
|
@@ -144,7 +144,7 @@ def train_model(
|
|
| 144 |
fc_dim: int = 256,
|
| 145 |
learning_rate: float = 0.001,
|
| 146 |
weight_decay: float = 0.0001,
|
| 147 |
-
batch_size: int =
|
| 148 |
epochs: int = 30,
|
| 149 |
model_tag: str = "",
|
| 150 |
):
|
|
|
|
| 144 |
fc_dim: int = 256,
|
| 145 |
learning_rate: float = 0.001,
|
| 146 |
weight_decay: float = 0.0001,
|
| 147 |
+
batch_size: int = 16,
|
| 148 |
epochs: int = 30,
|
| 149 |
model_tag: str = "",
|
| 150 |
):
|