Skip to content
Snippets Groups Projects
Commit c989d6fc authored by mbenimam's avatar mbenimam
Browse files

fixed merge

parents 0b25f440 24670f93
No related branches found
No related tags found
No related merge requests found
...@@ -109,7 +109,6 @@ def getCellsEvalutions(points, pointsPrediction, thresholds=10, minDist=20): ...@@ -109,7 +109,6 @@ def getCellsEvalutions(points, pointsPrediction, thresholds=10, minDist=20):
# the cost is the distance between the points # the cost is the distance between the points
# the assignment problem is solved using the Hungarian algorithm # the assignment problem is solved using the Hungarian algorithm
# the Hungarian algorithm is a special case of the linear sum assignment problem # the Hungarian algorithm is a special case of the linear sum assignment problem
# the Hungarian algorithm returns two arrays # the Hungarian algorithm returns two arrays
# row_ind is an array of row indices # row_ind is an array of row indices
# col_ind is an array of column indices # col_ind is an array of column indices
......
...@@ -94,20 +94,20 @@ class SegModel(pl.LightningModule): ...@@ -94,20 +94,20 @@ class SegModel(pl.LightningModule):
self.log('val_loss', loss) self.log('val_loss', loss)
if batch_nb == 0: # if batch_nb == 0:
out = torch.sigmoid(out)[0].cpu().numpy() # out = torch.sigmoid(out)[0].cpu().numpy()
thresholds = [0.5, 0.5, 0.6, 0.6, 0.7] # thresholds = [0.5, 0.5, 0.6, 0.6, 0.7]
thresholdedMasks = np.zeros_like(out) # thresholdedMasks = np.zeros_like(out)
for j in range(len(thresholds)): # for j in range(len(thresholds)):
thresholdedMasks[j] = out[j] > thresholds[j] # thresholdedMasks[j] = out[j] > thresholds[j]
fig, axes = plt.subplots(1, 5, figsize=(10, 2), dpi=200) # fig, axes = plt.subplots(1, 5, figsize=(10, 2), dpi=200)
axes = axes.flatten() # axes = axes.flatten()
# create new masks thresholded # create new masks thresholded
for j, mask in enumerate(out): # for j, mask in enumerate(out):
# print(mask.shape) # print(mask.shape)
# print(f"{dataset_test.id2cat[j]}: {mask.min()}, {mask.max()}") # print(f"{dataset_test.id2cat[j]}: {mask.min()}, {mask.max()}")
...@@ -124,14 +124,14 @@ class SegModel(pl.LightningModule): ...@@ -124,14 +124,14 @@ class SegModel(pl.LightningModule):
# mask = cv2.threshold(mask, 127, 255, cv2.THRESH_BINARY)[1] # mask = cv2.threshold(mask, 127, 255, cv2.THRESH_BINARY)[1]
# # mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel) # # mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel)
axes[j].imshow(mask) # axes[j].imshow(mask)
axes[j].axis('off') # axes[j].axis('off')
# axes[j].set_title(f"{dataset_test.id2cat[j]}") # axes[j].set_title(f"{dataset_test.id2cat[j]}")
self.logger.experiment.add_figure("masks", # self.logger.experiment.add_figure("masks",
fig, global_step=self.global_step) # fig, global_step=self.global_step)
plt.close(fig) # plt.close(fig)
return {'val_loss': loss} return {'val_loss': loss}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment