Skip to content

Resnet50/mseloss#15

Merged
luciana-munhos merged 7 commits intomainfrom
resnet50/mseloss
Jun 18, 2025
Merged

Resnet50/mseloss#15
luciana-munhos merged 7 commits intomainfrom
resnet50/mseloss

Conversation

@ghost
Copy link

@ghost ghost commented Jun 17, 2025

Refactor: Dataset Structure, Transformations & Interface Improvements

This PR introduces several updates to the dataset pipeline, transformations, and model interface. Below are the main changes:

Dataset and Loader

  • Dataset folder must now follow the structure:
    data/
    ├── abstrait/
    └── figuratif/

(Replaces previous folders like abstrait-v2, figuratif - aleat, etc.)

  • PaintingsDataset:
  • Now supports per-class augmentations via custom_augment_abstrait and custom_augment_figuratif.
  • double_abstract=True duplicates abstract samples to include both original and transformed versions in training.
  • Added n_transforms_augmented for dynamic random augmentation composition from a transform pool.
  • Padding logic now supports zero, mirror, and replicate modes.
  • Handles center crop and resizing for contrastive learning setups (transform=True).

Transformations

  • Added transformations/ folder to organize custom transformations:
  • SkewTransform
  • RandomStretch
  • These are used for abstract data augmentation and integrated into the default transform pool.

Dataset Split Script

  • New script: get_new_data.py
  • Splits a raw dataset into train/val/test.
  • Saves images in the correct folder structure (new_dataset/train/abstrait, etc.).
  • Applies default or custom augmentation to abstract images if provided.

Interface Enhancements

  • Interface class updated with new arguments:
  • load_model_path to resume training
  • freeze_layers for partial fine-tuning of ResNet50
  • weighted_loss to manually override automatic class weight calculation
  • Integration with per-class augmentations and double_abstract

Example Notebook

  • Added example usage in research/joel/20250617_weights.ipynb:
  • Demonstrates how to use the updated PaintingsDataset with custom transforms
  • Shows how to load the model and run embedding projections

@luciana-munhos luciana-munhos merged commit d51ea99 into main Jun 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants