zhry10 / phycnn Goto Github PK
View Code? Open in Web Editor NEWPhysics-guided Convolutional Neural Network
License: MIT License
Physics-guided Convolutional Neural Network
License: MIT License
您好,目前在做相關領域的研究,有閱讀過您的論文,非常厲害,本人也非常感興趣,本身是土木工程專業的,想請問您是否有嘗試用tensorflow2.0以上版本去運作,因為自己有嘗試過但是有很多地方有小錯誤,如果您有tensorflow2.0以上版本可以分享的話方便釋出供參考嗎?非常感謝,祝您一切順利!
Hi,
I added these two functions in the model class to save and load the models. It saves the files, but when we load the model, it is not loading the correct weights.
def save_NN(self, model_name):
saver = tf.train.Saver()
save_path = saver.save(self.sess, model_name)
print("Model saved in path: %s" % save_path)
def load_NN(self, model_name):
saver = tf.train.Saver()
saver.restore(self.sess, model_name)
print("Model restored.")
Code for training:
# with tf.device('/device:GPU:1'):
with tf.device('/cpu:0'):
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
# config.gpu_options.per_process_gpu_memory_fraction = 0.4
session = tf.Session(config=config)
# tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Training
model = DeepPhyLSTM(eta_tt_train, ag_train, Phi_t)
Loss = model.train(num_epochs=200, batch_size=N_train, learning_rate=1e-3, bfgs=1)
model.save_NN('./model_dir/model_name')
Code for loading:
with tf.device('/cpu:0'):
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
# config.gpu_options.per_process_gpu_memory_fraction = 0.4
session = tf.Session(config=config)
# tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Training
model2 = DeepPhyLSTM(eta_tt_train, ag_train, Phi_t)
model2.load_NN('./model_dir_5')
Thus, we are not able to reproduce the results directly(Right now, we have to train the model every time we want to use it).
Can you please let us know how to save and load the models correctly?
Thank you for sharing your code. I noticed that the output of the prediction is 3d dimensional and you describe in the code to use dof = 0. I understand that this problem is just analyzed in the lateral direction. Are there more dofs?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.