Skip to content

Commit

Permalink
bug with changes in channel choosing in training
Browse files Browse the repository at this point in the history
  • Loading branch information
carsen-stringer committed Oct 22, 2024
1 parent 8af9ebc commit f4df313
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions cellpose/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,8 @@ def train_model(self, restore=None, normalize_params=None):
model_type = None
self.logger.info(f"training new model starting from scratch")
self.current_model = model_type
self.channels = self.get_channels()
self.channels = self.training_params["channels"]

self.logger.info(
f"training with chan = {self.ChannelChoose[0].currentText()}, chan2 = {self.ChannelChoose[1].currentText()}"
)
Expand Down Expand Up @@ -2198,7 +2199,7 @@ def train_model(self, restore=None, normalize_params=None):
self.logger.info(f">>>> diameter set to diam_labels ( = {diam_labels: 0.3f} )")
self.restore = restore
self.set_normalize_params(normalize_params)
self.get_next_image(load_seg=True)
self.get_next_image(load_seg=False)

self.compute_segmentation(custom=True)
self.logger.info(
Expand Down
8 changes: 3 additions & 5 deletions cellpose/gui/guiparts.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def __init__(self, parent, model_strings):
yoff += 1
use_SGD = "SGD"
self.useSGD = QCheckBox(f"{use_SGD}")
self.useSGD.setToolTip("use SGD, if unchecked uses AdamW (recommended learning_rate then 1e-3)")
self.useSGD.setToolTip("use SGD, if unchecked uses AdamW (recommended learning_rate then 0.001)")
self.useSGD.setChecked(True)
self.l0.addWidget(self.useSGD, i+yoff, 1, 1, 1)

Expand Down Expand Up @@ -285,10 +285,6 @@ def __init__(self, parent, model_strings):
self.l0.addWidget(qlabel, i + 1, 5, 1, 1)

def accept(self, parent):
# set channels
for i in range(2):
parent.ChannelChoose[i].setCurrentIndex(
self.ChannelChoose[i].currentIndex())
# set training params
parent.training_params = {
"model_index": self.ModelChoose.currentIndex(),
Expand All @@ -297,6 +293,8 @@ def accept(self, parent):
"n_epochs": int(self.edits[2].text()),
"model_name": self.edits[3].text(),
"SGD": True if self.useSGD.isChecked() else False,
"channels": [self.ChannelChoose[0].currentIndex(),
self.ChannelChoose[1].currentIndex()],
#"use_norm": True if self.use_norm.isChecked() else False,
}
self.done(1)
Expand Down

0 comments on commit f4df313

Please sign in to comment.