Skip to content

Commit

Permalink
renable model training widget
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickcleeve2 committed Feb 1, 2024
1 parent 5f01fa0 commit 54f2b5a
Show file tree
Hide file tree
Showing 6 changed files with 359 additions and 337 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ fibsem/config/*.yaml
!fibsem/config/microscope-configuration.yaml
!fibsem/config/user-configurations.yaml
!fibsem/config/tescan_manipulator.yaml

**/wandb/*
38 changes: 26 additions & 12 deletions fibsem/segmentation/config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
data_path: /home/patrick/github/data/liftout/training/train/images
label_path: /home/patrick/github/data/liftout/training/train/labels
save_path: /home/patrick/github/fibsem/fibsem/segmentation/models/autoliftout/xl/base/nc3/earlystop
checkpoint: null
encoder: "resnet50"
epochs: 5
batch_size: 4
num_classes: 3
lr: 3.0e-4
wandb: true
wandb_project: "autoliftout"
wandb_entity: "demarcolab"
# data
data_paths: [/path/to/data, /path/to/second/data] # paths to image data (multiple supported)
label_paths: [/path/to/data/labels, /path/to/second/data/labels] # paths to label data (multiple supported)
save_path: /path/to/save/checkpoints # path to save checkpoints (checkpointed each epoch)
checkpoint: null # checkpoint to resume from

# model
encoder: "resnet34" # segmentation model encoder (imagenet)
num_classes: 6 # number of classes

# training
epochs: 50 # number of epochs
split: 0.1 # train / val split
batch_size: 4 # batch size
lr: 3.0e-4 # initial learning rate

# logging
train_log_freq: 32 # frequency to log training images
val_log_freq: 32 # frequency to log validation images

# wandb
wandb: true # enable wandb logging
wandb_project: "autolamella-mega" # wandb project
wandb_entity: "openfibsem" # wandb user / org
model_type: "mega-model" # model type note (descriptive only)
note: "notes about this specific training run" # additional trianing note (descriptive only)
2 changes: 1 addition & 1 deletion fibsem/ui/FibsemLabellingUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# setup a basic logger
logging.basicConfig(stream=sys.stdout, level=logging.INFO)

_DEBUG = True
_DEBUG = False

# new line char in html
NL = "<br>"
Expand Down
17 changes: 7 additions & 10 deletions fibsem/ui/FibsemModelTrainingWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def setup_connections(self):

checkpoint = config["checkpoint"] if config["checkpoint"] is not None else ""

self.lineEdit_data_path.setText(config["data_path"])
self.lineEdit_label_path.setText(config["label_path"])
self.lineEdit_save_path.setText(config["path"])
self.lineEdit_data_path.setText(config["data_paths"][0])
self.lineEdit_label_path.setText(config["label_paths"][0])
self.lineEdit_save_path.setText(config["save_path"])
self.comboBox_encoder.setCurrentText(config["encoder"])
self.lineEdit_checkpoint.setText(checkpoint)
self.spinBox_num_classes.setValue(config["num_classes"])
Expand All @@ -69,9 +69,9 @@ def train_model(self):
checkpoint = None if checkpoint == "" else checkpoint

config = {
"data_path": self.lineEdit_data_path.text(),
"label_path": self.lineEdit_label_path.text(),
"path": self.lineEdit_save_path.text(),
"data_paths": [self.lineEdit_data_path.text()],
"label_paths": [self.lineEdit_label_path.text()],
"save_path": self.lineEdit_save_path.text(),
"encoder": self.comboBox_encoder.currentText(),
"checkpoint": checkpoint,
"num_classes": int(self.spinBox_num_classes.value()),
Expand Down Expand Up @@ -113,10 +113,7 @@ def train_worker(self, config: dict):
optimizer,
train_data_loader,
val_data_loader,
epochs=config["epochs"],
save_dir=config["save_path"],
WANDB=config["wandb"],
ui=self.ui_signal,
config=config,
)

def train_model_yielded(self, info: dict):
Expand Down
Loading

0 comments on commit 54f2b5a

Please sign in to comment.