Cannot load Tensorflow model in java using SavedModelBundle

Viewed 199

I am trying to load mobilenet model from this link. The model is stored on disk at the following path

C:\Users\userName\IdeaProjects\ImageClassification\src\main\resources\mobilenet_v2_1.4_224\mobilenet_v2_1.4_224.pb

Following is the code which is located at this path C:\Users\userName\IdeaProjects\ImageClassification\src\main\java\com\DeepLearning\ImgClassification.java

try(SavedModelBundle modelBundle = SavedModelBundle.load("src/main/resources/mobilenet_v2_1.4_224", "serve")){
            Session mobileNetSession = modelBundle.session();

            System.out.println(mobileNetSession);

        }catch (TensorFlowException t){
            System.out.println(t.getMessage());
        }

I am trying to load the .pb using SavedModelBundle.load(), but I get the following error

2020-07-31 12:40:35.385591: I tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: src/main/resources/mobilenet_v2_1.4_224
2020-07-31 12:40:35.570627: I tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }
2020-07-31 12:40:35.577560: I tensorflow/cc/saved_model/loader.cc:311] SavedModel load for tags { serve }; Status: fail. Took 191903 microseconds.
Could not find meta graph def matching supplied tags: { serve }. To inspect available tag-sets in the SavedModel, please use the SavedModel CLI: `saved_model_cli`

How do I resolve the path of the model? What am I mising here? Thanks.

0 Answers
Related