jays009 commited on
Commit
f6d8ad8
·
verified ·
1 Parent(s): 7f18e65

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -39
README.md CHANGED
@@ -1,39 +1,40 @@
1
- ---
2
- model_name: "Wheat Anomaly Detection Model"
3
- tags:
4
- - pytorch
5
- - resnet
6
- - agriculture
7
- - anomaly-detection
8
- license: apache-2.0
9
- library_name: pytorch
10
-
11
- # Wheat Anomaly Detection Model
12
-
13
- This model is a PyTorch-based ResNet model trained to detect anomalies in wheat crops, such as diseases, pests, and nutrient deficiencies.
14
-
15
- ## How to Load the Model
16
-
17
- To load the trained model, use the following code:
18
-
19
- ```python
20
- from transformers import AutoModelForImageClassification
21
- import torch
22
-
23
- # Load the pre-trained model
24
- model = AutoModelForImageClassification.from_pretrained('your_huggingface_username/your_model_name')
25
-
26
- # Put the model in evaluation mode
27
- model.eval()
28
-
29
- # Example of making a prediction
30
- image_path = "path_to_your_image.jpg" # Replace with your image path
31
- image = Image.open(image_path)
32
- inputs = transform(image).unsqueeze(0) # Apply the necessary transformations to the image
33
- inputs = inputs.to(device)
34
-
35
- # Make a prediction
36
- with torch.no_grad():
37
- outputs = model(inputs)
38
- predicted_class = torch.argmax(outputs.logits, dim=1)
39
- print(f"Predicted Class: {predicted_class.item()}")
 
 
1
+ ---
2
+ model_name: "Wheat Anomaly Detection Model"
3
+ tags:
4
+ - pytorch
5
+ - resnet
6
+ - agriculture
7
+ - anomaly-detection
8
+ license: apache-2.0
9
+ library_name: pytorch
10
+ ---
11
+
12
+ # Wheat Anomaly Detection Model
13
+
14
+ This model is a PyTorch-based ResNet model trained to detect anomalies in wheat crops, such as diseases, pests, and nutrient deficiencies.
15
+
16
+ ## How to Load the Model
17
+
18
+ To load the trained model, use the following code:
19
+
20
+ ```python
21
+ from transformers import AutoModelForImageClassification
22
+ import torch
23
+
24
+ # Load the pre-trained model
25
+ model = AutoModelForImageClassification.from_pretrained('your_huggingface_username/your_model_name')
26
+
27
+ # Put the model in evaluation mode
28
+ model.eval()
29
+
30
+ # Example of making a prediction
31
+ image_path = "path_to_your_image.jpg" # Replace with your image path
32
+ image = Image.open(image_path)
33
+ inputs = transform(image).unsqueeze(0) # Apply the necessary transformations to the image
34
+ inputs = inputs.to(device)
35
+
36
+ # Make a prediction
37
+ with torch.no_grad():
38
+ outputs = model(inputs)
39
+ predicted_class = torch.argmax(outputs.logits, dim=1)
40
+ print(f"Predicted Class: {predicted_class.item()}")