Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
f7121e88
Commit
f7121e88
authored
Jul 26, 2021
by
Cagri Eryilmaz
Browse files
remove torch requirement
parent
2cb33839
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
examples/python_unet/unet_inference.ipynb
examples/python_unet/unet_inference.ipynb
+13
-3
No files found.
examples/python_unet/unet_inference.ipynb
View file @
f7121e88
...
@@ -18,8 +18,7 @@
...
@@ -18,8 +18,7 @@
"import migraphx\n",
"import migraphx\n",
"from PIL import Image\n",
"from PIL import Image\n",
"import numpy as np\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.pyplot as plt"
"import torch"
]
]
},
},
{
{
...
@@ -159,6 +158,17 @@
...
@@ -159,6 +158,17 @@
"output_mask.shape"
"output_mask.shape"
]
]
},
},
{
"cell_type": "code",
"execution_count": null,
"id": "acbd68e3",
"metadata": {},
"outputs": [],
"source": [
"def sigmoid(x):\n",
" return 1 / (1 + np.exp(-x))"
]
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": null,
...
@@ -166,7 +176,7 @@
...
@@ -166,7 +176,7 @@
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"probs =
torch.
sigmoid(
torch.from_numpy(
output_mask)
)
\n",
"probs = sigmoid(output_mask)\n",
"full_mask = probs > 0.996\n",
"full_mask = probs > 0.996\n",
"plot_img_and_mask(imPrint, full_mask)"
"plot_img_and_mask(imPrint, full_mask)"
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment