Skip to content

Commit 176e9c8

Browse files
ben2kBenjamin Auberteigenvivek
authored
Fix blur in Sobel filter (#389)
* Bug fix in Sobel. * Update source notebook --------- Co-authored-by: Benjamin Aubert <baubert@eos-imaging.com> Co-authored-by: Vivek Gopalakrishnan <vivekg@mit.edu>
1 parent 13a9a22 commit 176e9c8

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

diffdrr/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def forward(self, x1, x2):
6767

6868

6969
class Sobel(torch.nn.Module):
70-
def __init__(self, sigma):
70+
def __init__(self, sigma: float):
7171
super().__init__()
7272
self.sigma = sigma
7373
self.filter = torch.nn.Conv2d(
@@ -86,7 +86,7 @@ def __init__(self, sigma):
8686

8787
def forward(self, img):
8888
x = gaussian_blur(img, 5, self.sigma)
89-
x = self.filter(img)
89+
x = self.filter(x)
9090
return x
9191

9292
# %% ../notebooks/api/05_metrics.ipynb 10

notebooks/api/05_metrics.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"\n",
162162
"\n",
163163
"class Sobel(torch.nn.Module):\n",
164-
" def __init__(self, sigma):\n",
164+
" def __init__(self, sigma: float):\n",
165165
" super().__init__()\n",
166166
" self.sigma = sigma\n",
167167
" self.filter = torch.nn.Conv2d(\n",
@@ -180,7 +180,7 @@
180180
"\n",
181181
" def forward(self, img):\n",
182182
" x = gaussian_blur(img, 5, self.sigma)\n",
183-
" x = self.filter(img)\n",
183+
" x = self.filter(x)\n",
184184
" return x"
185185
]
186186
},

0 commit comments

Comments
 (0)