Amith4504 / Frozen-Graph-Inference-MaskRCNN

Semantic Segmentation [MaskRCNN] using Frozen graph for inference . The repository contains code to freeze a TensorFlow .h5 model [.h5 to .pb] and inference using the frozen model.
6 stars 1 forks source link

Dependencies causing isssues #1

Open pra-dan opened 3 years ago

pra-dan commented 3 years ago

Hi, Thanks for this. Although, I noticed that the current tensorflow and keras versions are causing troubles. I personally got the following error:

from keras.engine import saving as saving
ImportError: cannot import name 'saving'

On googling, I found that its probably due to keras older versions. Can you please provide dependencies that your project requires ?

Thanks

timothyaya commented 3 years ago

you can downgrade the h5py version to 2.10.0 (with tensorflow==1.12.0 keas==2.2.4). my problem is solved by doing this. I can convert the mask_rcnn_coco.h5 to pb file and detect a car.jpg to test_image folder without issues. However, when I trying to convert a custom trained h5, I can convert it to pb file with my only config class. When I use this pb file to detect picture, I got error: ValueError: Cannot feed value of shape (1, 93) for Tensor 'input_image_meta:0', which has shape '(?, 15)' and I also got error when using the pb file to convert to pbtxt with tf_text_graph_mask_rcnn.py of opencv.

Anyway, this is the nearest repo. to succeed to convert h5 to pb file. I tried many ways and failed.

pra-dan commented 3 years ago

There is no official method to convert h5 to pb in case of mask rcnn.