Skip to content

Commit

Permalink
Add transform example
Browse files Browse the repository at this point in the history
  • Loading branch information
U-DESKTOP-A6FGL28\nekit committed Aug 17, 2020
1 parent d290825 commit 8a9e3d5
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions starnet_v1_TF2_transform.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import tensorflow as tf\n",
"from PIL import Image as img\n",
"import logging\n",
"tf.get_logger().setLevel(logging.ERROR)\n",
"from starnet_v1_TF2 import StarNet"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"starnet = StarNet(mode = 'RGB', window_size = 512)\n",
"starnet.load_model('./weights', './history')"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"name = \"rgb_test5.tif\"\n",
"output = starnet.transform(name)\n",
"if starnet.mode == 'RGB':\n",
" img.fromarray(output.astype('uint8'), mode = 'RGB').save(name + '_starless.tif')\n",
"else:\n",
" img.fromarray(output.astype('uint8'), mode = 'L').save(name + '_starless.tif')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 8a9e3d5

Please sign in to comment.