-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from nekitmm/tf2
Tf2
- Loading branch information
Showing
4 changed files
with
85 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
To download pre-trained weights, follow this link (~500Mb) | ||
To download pre-trained weights, follow the links below: | ||
|
||
https://www.dropbox.com/s/atcs42ox4n99w96/starnet_weights.zip?dl=0 | ||
For TF1.x implementation: | ||
|
||
And extract all the content into root folder (folder with this file). | ||
https://www.dropbox.com/s/atcs42ox4n99w96/starnet_weights.zip?dl=0 | ||
|
||
For TF2.x implementation: | ||
|
||
https://www.dropbox.com/s/lcgn5gvnxpo27s5/starnet_weights2.zip?dl=0 | ||
|
||
Or you might also use lfs (if you know what that means, otherwise ignore this). | ||
And extract all the content into root folder (folder with this file). |