I use resnet model which downloaded from tf hub, the size is 214M;
it take more than 10mins to load each time, can someont tell me why it’s taking so long?very thankful
@Herminone-xueyan could you tell me a bit more about your environment? Anything from limited ram to your disk could be affecting this. I need the version as well.
Can you also show me your loading code? Thanks!
Thanks for your reply, my computer run on win11, the ram is 32GB, cpu:Intel(R) Core™ i7-9700 CPU @ 3.00GHz 3.00 GHz.
I download the link to the model:TensorFlow Hub
my code references the “ImportMobileNetExample.java”, by the way, this examples runs incorrectly.
String modelPath = "src/test/resources/pre_train_models/resnet_frozen.pb";
File modelFile = new File(modelPath);
TensorflowFrameworkImporter tensorflowFrameworkImporter = new TensorflowFrameworkImporter();
//load img
ImageLoader imgLoader = new ImageLoader(128,128,3);
String imgPath = "src/test/resources/images/fox.png";
File img = new File(imgPath);
System.out.println("ND4J Data Type Setting: " + Nd4j.dataType());
INDArray input = imgLoader.asMatrix(img);
// pre-process img
System.out.println(input.shapeInfoToString());
input = input.permute(0, 2, 3, 1);
input = input.div(255.0f);
System.out.println(input.shapeInfoToString());
//load model
SameDiff sd = tensorflowFrameworkImporter.runImport(modelFile.getAbsolutePath(), singletonMap("inputs", input), false);
Above is the code I used to load the model. I would also like to ask if there is some complete API documentation outside of javadoc(javadoc is not easy to use),such as an introduction to the parameters of the runImport() method.
Thank you again and look forward to your reply.