Instructions to use google/efficientnet-b7 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/efficientnet-b7 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="google/efficientnet-b7") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("google/efficientnet-b7") model = AutoModelForImageClassification.from_pretrained("google/efficientnet-b7") - Inference
- Notebooks
- Google Colab
- Kaggle
Converting logits to probability
#3
by ToonWeyens - opened
How do I get something like a probability?
Running
predicted_label = logits.argmax(-1).item()
predicted_label_name = self.model.config.id2label[predicted_label]
predicted_probability = probabilities[0, predicted_label].item()
I typically get something in the range of 0.001 - 0.002, which is very far from something like 0.5-0.9 that i am expecting for this pre-trained model.