Downloads · 30 days
0
faldeus0092/tyre-classification-efficientnetb7
tyre-classification-efficientnetb7 is a machine learning model from faldeus0092. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
(this model was not trained using Trainer API) This model is a fine-tuned version of EfficientNetB7 on the Tyre-Quality-Classification dataset. It achieves the following results on the evaluation set:
Downloads · 30 days
0
Access
Public
Updated Oct 3, 2023
Repo size
257 MB
Likes
0
Public
Click a slice to open those files.
.pth257 MB · 100%
From the Hugging Face model README
(this model was not trained using Trainer API) This model is a fine-tuned version of EfficientNetB7 on the Tyre-Quality-Classification dataset. It achieves the following results on the evaluation set:
Can be used for quality control to identify the condition of tyres
Data can be seen at Weights and Biases
The following hyperparameters were used during training:
from efficientnet_pytorch import EfficientNet
import torch
import torchvision.transforms as transforms
model = EfficientNet.from_name('efficientnet-b7')
model._fc= torch.nn.Linear(in_features=model._fc.in_features, out_features=len(annotations_map), bias=True)
model.load_state_dict(torch.load('/content/efficientnetb7_tyrequality_classifier.pth'))
model.eval()
img = Image.open('/content/defective-tires-cause-accidents-min.jpg')
test_transform = transforms.Compose([
transforms.Resize(224),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406],
[0.229, 0.224, 0.225])
])
input_data = test_transform(img).unsqueeze(0)
with torch.no_grad():
output = model(input_data)
_, predicted_class = torch.max(output, 1)
probs = torch.nn.functional.softmax(output, dim=1)
conf, _ = torch.max(probs, 1)
print('Predicted Class:', predicted_class.item())
print('Predicted Label:', id2label[predicted_class.item()])
print(f'Confidence: {conf.item()*100}%')
plt.title(id2label[predicted_class.item()])
plt.axis("off")
plt.imshow(img)
plt.show()