Skip to content

Commit f4df313

Browse files
bug with changes in channel choosing in training
1 parent 8af9ebc commit f4df313

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

cellpose/gui/gui.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,8 @@ def train_model(self, restore=None, normalize_params=None):
21602160
model_type = None
21612161
self.logger.info(f"training new model starting from scratch")
21622162
self.current_model = model_type
2163-
self.channels = self.get_channels()
2163+
self.channels = self.training_params["channels"]
2164+
21642165
self.logger.info(
21652166
f"training with chan = {self.ChannelChoose[0].currentText()}, chan2 = {self.ChannelChoose[1].currentText()}"
21662167
)
@@ -2198,7 +2199,7 @@ def train_model(self, restore=None, normalize_params=None):
21982199
self.logger.info(f">>>> diameter set to diam_labels ( = {diam_labels: 0.3f} )")
21992200
self.restore = restore
22002201
self.set_normalize_params(normalize_params)
2201-
self.get_next_image(load_seg=True)
2202+
self.get_next_image(load_seg=False)
22022203

22032204
self.compute_segmentation(custom=True)
22042205
self.logger.info(

cellpose/gui/guiparts.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def __init__(self, parent, model_strings):
236236
yoff += 1
237237
use_SGD = "SGD"
238238
self.useSGD = QCheckBox(f"{use_SGD}")
239-
self.useSGD.setToolTip("use SGD, if unchecked uses AdamW (recommended learning_rate then 1e-3)")
239+
self.useSGD.setToolTip("use SGD, if unchecked uses AdamW (recommended learning_rate then 0.001)")
240240
self.useSGD.setChecked(True)
241241
self.l0.addWidget(self.useSGD, i+yoff, 1, 1, 1)
242242

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

287287
def accept(self, parent):
288-
# set channels
289-
for i in range(2):
290-
parent.ChannelChoose[i].setCurrentIndex(
291-
self.ChannelChoose[i].currentIndex())
292288
# set training params
293289
parent.training_params = {
294290
"model_index": self.ModelChoose.currentIndex(),
@@ -297,6 +293,8 @@ def accept(self, parent):
297293
"n_epochs": int(self.edits[2].text()),
298294
"model_name": self.edits[3].text(),
299295
"SGD": True if self.useSGD.isChecked() else False,
296+
"channels": [self.ChannelChoose[0].currentIndex(),
297+
self.ChannelChoose[1].currentIndex()],
300298
#"use_norm": True if self.use_norm.isChecked() else False,
301299
}
302300
self.done(1)

0 commit comments

Comments
 (0)