Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check message on return from seg train #57

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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