New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Efficientnet B7 classification conversion from tf to tflite fails tflite imagenet evaluation test #60053
Comments
@suyash-narain Thank you ! |
Hi, i tried to convert the model using if i use the below method:
the input shape becomes (1,600,600,3) as desired, and has the output shape (1,1000). The official ImageNetLabels.txt available at https://storage.googleapis.com/download.tensorflow.org/data/ImageNetLabels.txt has total of 1001 labels ranging from (0-1000). So in that way, the output shape for this model should be (1,1001). When I run it against tflite imagenet evaluation tool, i get the same error I get similar error results if i use |
@suyash-narain Thank you! |
@tiruk007 Please find the detailed steps I exercised towards building the provided tflite imagenet evaluation tool:
|
Sorry for the delayed response. As the tool for evaluation is based on ILSVRC 2012 task, the classes with shape [1,1001] are only accepted for the evaluation. The tensorflow hub provides modules trained on ImageNet (ILSVRC-2012-CLS) which return the output shapes as Please find the list of models here. Thanks. |
Hi @pjpratik
i get output model shape as [1.1000]. I run this model against imagenet labels having 1000 classes from 1-1000 (removing 0-background), and it works. Same way, if i run efficientnetlite4 downloaded from https://tfhub.dev/tensorflow/efficientnet/lite4/classification/2, and run it against imagenet labels having 1000 classes from 1-1000 after removing 0-background class, it still works. thanks
|
Hi @suyash-narain Thanks for the clarification. Sorry for the delayed response. I was able to reproduce this issue. Please find the screenshot here. @sachinprasadhs Could you please look into this? Thanks. |
System information
provided in TensorFlow): No
happens on a mobile device: No
Describe the problem
I am trying to convert efficientnet_b7_classification model available in tfhub: https://storage.googleapis.com/tfhub-modules/tensorflow/efficientnet/b7/classification/1.tar.gz to tflite
I use the below code snippet to convert the saved model to tflite:
on visualizing the model on netron, i saw that the input to the model is of shape (1,1,1,3). whereas, the input to efficientnet_b7 is 600x600. So the converted model should have the shape (1,600,600,3), but i don't see this.
The output of the model is of the shape (1,1000).
But on visualizing the model, i still see the input shape as (1,1,1,3), and output shape is (1,1000). The model has been trained on imagenet so output shape should be fine with the label file consisting of 1000 labels starting from 1-1000 instead of 0-1000 which includes the dummy as well.
so from my labelfile, i removed the dummy, and it then used the same labelfile to evaluate the tflite model using the imagenet_image_classification run_eval binary. On running it against the converted tflite model, i get the below error log, which seemingly says that the model output shape is wrong. What is the correct way to go about converting and testing efficientnet_b7 model?
The output shape of mobilenets is (1,1001), whereas that of efficientnets is (1,1000) even though both are trained on imagenet dataset. why is that so?
thanks!
Source code / logs
The text was updated successfully, but these errors were encountered: