Skip to content

Commit

Permalink
add spectralNormalization into Gans Network and GP for the Wgans
Browse files Browse the repository at this point in the history
  • Loading branch information
smitharauco committed Sep 18, 2020
1 parent f6e1b80 commit cfeb11d
Show file tree
Hide file tree
Showing 8 changed files with 2,418 additions and 115 deletions.
226 changes: 136 additions & 90 deletions Model/GansNetworks.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Model/GansUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from Model.BiLinearUp import BilinearUpsampling
from Model.Utils import Save_Model, PlotDataAE
from Model.UtilsPCA import ComputePCA
from Model.SpectralNormalizationLayers import DenseSN, ConvSN2D
from keras_layer_normalization import LayerNormalization

class Utilities(object):
@staticmethod
Expand Down Expand Up @@ -76,7 +78,7 @@ def acc_cpu(y_true, y_pred):
@staticmethod
def build_pretrained_model(model_file, isTrain=True):
with open(model_file + '.json', 'r') as f:
model = model_from_json(f.read(), custom_objects={'BilinearUpsampling': BilinearUpsampling()})
model = model_from_json(f.read(), custom_objects={'BilinearUpsampling': BilinearUpsampling(),'DenseSN':DenseSN,'ConvSN2D':ConvSN2D, 'LayerNormalization': LayerNormalization()})
model.load_weights(model_file + '_weights.hdf5')
if isTrain is False:
model.trainable = False
Expand Down
433 changes: 418 additions & 15 deletions Model/GeoGans.py

Large diffs are not rendered by default.

670 changes: 670 additions & 0 deletions Model/SpectralNormalizationLayers.py

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions Train_DCVAE_2FaciesLarge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Colocations handled automatically by placer.\n"
"ename": "ModuleNotFoundError",
"evalue": "No module named 'requests'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-ca3a43307f66>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mModel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDCVAE\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDCVAE\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mModel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mUtils\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPlotHistory\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mPlotDataAE\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSave_Model\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mModel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mUtils\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mload_from_tfrecords\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mconvert_to_tfrecords\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mload_numpy\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mkeras\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moptimizers\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mRMSprop\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mAdam\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/share/GeoFacies/GeoFacies_DL/Model/DCVAE.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mtensorflow\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 21\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mModel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mUtils\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mkl_normal\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkl_discrete\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msampling_normal\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mEPSILON\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 22\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mModel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mBiLinearUp\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mBilinearUpsampling\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/share/GeoFacies/GeoFacies_DL/Model/Utils.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0msklearn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodel_selection\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mtrain_test_split\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mtensorflow\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpython\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeras\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mutils\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata_utils\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mget_file\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mrequests\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'requests'"
]
}
],
Expand Down Expand Up @@ -6726,7 +6730,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion Train_DCVAE_Inc_MPS45_Keras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2313,7 +2313,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion Train_DCVAE_MPS45_Keras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3260,7 +3260,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
1,178 changes: 1,178 additions & 0 deletions Training_Gans_SpectralNormalization_MPS60.ipynb

Large diffs are not rendered by default.

0 comments on commit cfeb11d

Please sign in to comment.