tyagi-iiitv / PointPillars

GNU General Public License v3.0
105 stars 47 forks source link

save as pb #22

Open zhenglongjiepheonix opened 3 years ago

zhenglongjiepheonix commented 3 years ago

hey, i am using model.save as you mentioned so that i could get .pb file, but it turns out that i only get a file without any suffixes which is not in pb format

zhenglongjiepheonix commented 3 years ago

according to the official documents, it could only be saved as h5 or tf format, how it could be saved as pb format

tyagi-iiitv commented 3 years ago

Hey, I faced the same error when I tried to create the pb file in Google Colab instead of my AWS environment, however it works just fine in my AWS environment. I'm still trying to figure it out. I'll let you know once it's sorted out. In the meantime, if you figure it out, please let me know. Thanks for pointing it out!

On Wed, Nov 4, 2020 at 3:25 AM zhenglongjiepheonix notifications@github.com wrote:

when I am trying to tf.keras.models.load_model('new_model.h5'), which is gererated by save_model after loading your 'model.h5' ,it seems something wrong with your lambda layer [image: pb] https://user-images.githubusercontent.com/32992656/98086721-1b8e6800-1eba-11eb-97bc-22156cfde51b.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tyagi-iiitv/PointPillars/issues/22#issuecomment-721585229, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7IJ5RPVEQVP3YGIKLT7ULSOEFXBANCNFSM4TJUSLUA .

zhenglongjiepheonix commented 3 years ago

I even tried to convert h5 to pb but when I use model.save() to save the file as "model.h5" , and later try to load using load_model("model.h5"), some error occurs. I think it would be better to implement in TF 1.x framework instead of using high level API like keras, since TF 1.x seems to support pb file better

zhenglongjiepheonix commented 3 years ago

After all pb file is more important for deployment and acceleration

tyagi-iiitv commented 3 years ago

I think to load the model without using Keras, use tf.saved_model.load('model_directory'). It worked fine for me when I loaded my saved pb model.

Manueljohnson063 commented 3 years ago

Hai when i train the model i got the error Traceback (most recent call last): File "point_pillars_training_run.py", line 26, in pillar_net.load_weights(os.path.join(MODEL_ROOT, "model.h5")) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 2227, in load_weights with h5py.File(filepath, 'r') as f: File "/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py", line 408, in init swmr=swmr) File "/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py", line 173, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 88, in h5py.h5f.open OSError: Unable to open file (unable to open file: name = './logs/model.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)