Added more class labels in test 3.

This commit is contained in:
K
2025-02-22 19:34:37 +05:30
parent 33a634ef7b
commit 9ef589d638
+21 -5
View File
@@ -8,15 +8,31 @@ model_name = "TonyStarkD99/CLIP-Crop_Disease-Large"
model = CLIPModel.from_pretrained(model_name) model = CLIPModel.from_pretrained(model_name)
# Load your image # Load your image
image_path = "/home/overnion/Status200/potato.png" # Replace with your image path image_path = "/home/overnion/Status200/tomato.png" # Replace with your image path
image = Image.open(image_path) image = Image.open(image_path)
# Define the class labels (text prompts) # Define the class labels (text prompts)
class_labels = [ class_labels = [
"healthy plant", "healthy plant",
"diseased plant", "powdery mildew",
"wilted plant", "leaf rust",
"pest-infested plant" "stem rust",
"fusarium head blight",
"gray leaf spot",
"bacterial blight",
"downy mildew",
"aphid infestation",
"white mold",
"black rot",
"root rot",
"yellow leaf curl",
"blight",
"necrotic spots",
"chlorosis",
"wilt",
"damping off",
"viral infection",
"pest damage"
] ]
# Resize and normalize the image # Resize and normalize the image
@@ -46,5 +62,5 @@ predicted_class = class_labels[predicted_class_idx]
# Print the predicted class and probabilities # Print the predicted class and probabilities
print("Predicted class:", predicted_class) print("Predicted class:", predicted_class)
print("Probabilities:", probs.detach().numpy()) # print("Probabilities:", probs.detach().numpy())