Training#

Training module for compound profiling.

SimCLR Vanilla Training#

training.simclr_vanilla_train.train_simclr_vanilla(root_path='/scratch/cv-course2025/group8', epochs=200, batch_size=256, learning_rate=0.0003, temperature=0.5, projection_dim=128, device=None, save_every=50, save_dir='/scratch/cv-course2025/group8/model_weights/vanilla', compound_aware=False)[source]#

Train vanilla SimCLR model using two augmentations of the same image, optionally with compound-aware loss that excludes same-compound negatives.

Parameters:
  • root_path – Path to BBBC021 dataset

  • epochs – Number of training epochs

  • batch_size – Batch size for training

  • learning_rate – Learning rate for optimizer

  • temperature – Temperature parameter for contrastive loss

  • projection_dim – Output dimension of projection head

  • device – Device to train on

  • save_every – Save model every N epochs

  • save_dir – Directory to save model weights

  • compound_aware – If True, uses compound-aware loss that excludes same-compound negatives

SimCLR Weakly-Supervised Training#

training.simclr_ws_train.train_simclr(root_path='/scratch/cv-course2025/group8', epochs=200, batch_size=512, learning_rate=0.0003, temperature=0.1, projection_dim=128, device=None, save_every=20)[source]#

Training wrapper for SimCLR model on BBBC021 dataset

Parameters:
  • root_path – Path to BBBC021 dataset

  • epochs – Number of training epochs

  • batch_size – Batch size for training

  • learning_rate – Learning rate for optimizer

  • temperature – Temperature parameter for contrastive loss

  • projection_dim – Output dimension of projection head

  • device – Device to train on

  • save_every – Save model every N epochs

WS-DINO ResNet Training#

training.wsdino_resnet_train.train_wsdino(root_path='/scratch/cv-course2025/group8', epochs=200, batch_size=512, lr=0.0003, momentum=0.996, temperature=0.1, proj_dim=128, save_every=50)[source]#

Training WS-DINO with a ResNet50 backbone on the BBBC021 dataset.

Parameters:
  • root_path – Path to BBBC021 dataset

  • epochs – Number of training epochs

  • batch_size – Batch size for training

  • lr – Learning rate for optimizer

  • momentum

  • temperature – Temperature parameter for DINO-style loss

  • projection_dim – Output dimension of projection head

  • save_every – Save model every N epochs