Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RegionSegmentation
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mohamed Mounib BENIMAM
RegionSegmentation
Commits
c989d6fc
Commit
c989d6fc
authored
2 years ago
by
mbenimam
Browse files
Options
Downloads
Plain Diff
fixed merge
parents
0b25f440
24670f93
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/evaluate.py
+0
-1
0 additions, 1 deletion
src/evaluate.py
src/models.py
+14
-14
14 additions, 14 deletions
src/models.py
with
14 additions
and
15 deletions
src/evaluate.py
+
0
−
1
View file @
c989d6fc
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
src/models.py
+
14
−
14
View file @
c989d6fc
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment