File size: 1,379 Bytes
f6d8ad8
1db589c
f6d8ad8
dcaa06f
 
 
 
f6d8ad8
dcaa06f
 
 
 
 
 
 
 
 
 
 
1db589c
f6d8ad8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1db589c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
model_name: Wheat Anomaly Detection Model
tags:
  - pytorch
  - resnet
  - agriculture
  - anomaly-detection
license: apache-2.0
library_name: transformers
datasets:
  - wheat-disease-dataset
model_type: resnet
preprocessing:
  - resize: 256
  - center_crop: 224
  - normalize: [0.485, 0.456, 0.406]
  - normalize_std: [0.229, 0.224, 0.225]
framework: pytorch
task: image-classification
pipeline_tag: image-classification
---

# Wheat Anomaly Detection Model

This model is a PyTorch-based ResNet model trained to detect anomalies in wheat crops, such as diseases, pests, and nutrient deficiencies.

## How to Load the Model

To load the trained model, use the following code:

```python
from transformers import AutoModelForImageClassification
import torch

# Load the pre-trained model
model = AutoModelForImageClassification.from_pretrained('your_huggingface_username/your_model_name')

# Put the model in evaluation mode
model.eval()

# Example of making a prediction
image_path = "path_to_your_image.jpg"  # Replace with your image path
image = Image.open(image_path)
inputs = transform(image).unsqueeze(0)  # Apply the necessary transformations to the image
inputs = inputs.to(device)

# Make a prediction
with torch.no_grad():
    outputs = model(inputs)
    predicted_class = torch.argmax(outputs.logits, dim=1)
    print(f"Predicted Class: {predicted_class.item()}")