Skip to content

Commit

Permalink
Merge pull request #57 from HelmholtzAI-Consultants-Munich/client-fix…
Browse files Browse the repository at this point in the history
…-empty-folder-msg

check message on return from seg train
  • Loading branch information
christinab12 authored Dec 18, 2023
2 parents 5345dd2 + 9529569 commit 37c1033
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/server/dcp_server/segmentationclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self, imagestorage, runner, model):
self.imagestorage = imagestorage
self.runner = runner
self.model = model
self.no_files_msg = "No image-label pairs found in curated directory"

async def segment_image(self, input_path, list_of_images):
"""Segments images from the given directory
Expand Down Expand Up @@ -65,7 +66,7 @@ async def train(self, input_path):
train_img_mask_pairs = self.imagestorage.get_image_seg_pairs(input_path)

if not train_img_mask_pairs:
return "No images and segs found"
return self.no_files_msg

imgs, masks = self.imagestorage.prepare_images_and_masks_for_training(train_img_mask_pairs)
model_save_path = await self.runner.train.async_run(imgs, masks)
Expand Down
5 changes: 3 additions & 2 deletions src/server/dcp_server/serviceclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ async def train(input_path):
"""
print("Calling retrain from server.")
# Train the model
model_path = await self.segmentation.train(input_path)
msg = "Success! Trained model saved in: " + model_path
msg = await self.segmentation.train(input_path)
if msg!=self.segmentation.no_files_msg:
msg = "Success! Trained model saved in: " + msg
return msg

return svc
Expand Down

0 comments on commit 37c1033

Please sign in to comment.