Hk4crprasad commited on
Commit
f29ea0e
·
verified ·
1 Parent(s): 85fddeb

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +98 -0
README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Grain Quality Classifier
3
+ emoji: 🌾
4
+ colorFrom: green
5
+ colorTo: yellow
6
+ sdk: pytorch
7
+ app_file: app.py
8
+ pinned: false
9
+ license: mit
10
+ tags:
11
+ - grain
12
+ - agriculture
13
+ - computer-vision
14
+ - quality-control
15
+ - multi-task-learning
16
+ - pytorch
17
+ ---
18
+
19
+ # Grain Quality Classification Model 🌾
20
+
21
+ A multi-task deep learning model for grain quality control, trained on Tesla T4 GPU.
22
+
23
+ ## Model Description
24
+
25
+ This model performs multi-task learning for grain quality assessment:
26
+ - **Count Prediction**: Estimates total grain count in images
27
+ - **Good Grain Count**: Counts high-quality grains
28
+ - **Bad Grain Count**: Counts low-quality/damaged grains
29
+ - **Quality Classification**: Binary classification (good/bad dominant)
30
+
31
+ ## Architecture
32
+
33
+ - **Backbone**: ResNet-50 (pre-trained on ImageNet)
34
+ - **Input Size**: 256x256 RGB images
35
+ - **Multi-task heads**: Separate heads for each prediction task
36
+ - **Training**: Mixed precision on Tesla T4 GPU
37
+
38
+ ## Training Details
39
+
40
+ - **Epochs**: 73
41
+ - **Best Validation Loss**: 23.005850791931152
42
+ - **Optimizer**: AdamW with OneCycleLR scheduler
43
+ - **Data Augmentation**: Extensive augmentations for robustness
44
+ - **GPU**: Tesla T4 with mixed precision training
45
+
46
+ ## Usage
47
+
48
+ ```python
49
+ import torch
50
+ from PIL import Image
51
+ import torchvision.transforms as transforms
52
+
53
+ # Load model
54
+ model = torch.load('pytorch_model.bin', map_location='cpu')
55
+ model.eval()
56
+
57
+ # Preprocessing
58
+ transform = transforms.Compose([
59
+ transforms.Resize((256, 256)),
60
+ transforms.ToTensor(),
61
+ transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
62
+ ])
63
+
64
+ # Inference
65
+ image = Image.open('grain_image.jpg').convert('RGB')
66
+ input_tensor = transform(image).unsqueeze(0)
67
+
68
+ with torch.no_grad():
69
+ outputs = model(input_tensor)
70
+
71
+ print(f"Count: {outputs['count'].item():.1f}")
72
+ print(f"Good grains: {outputs['good'].item():.1f}")
73
+ print(f"Bad grains: {outputs['bad'].item():.1f}")
74
+ print(f"Quality: {'Good' if outputs['quality'].argmax().item() == 1 else 'Bad'}")
75
+ ```
76
+
77
+ ## Model Performance
78
+
79
+ - Trained on agricultural grain dataset
80
+ - Multi-task learning approach
81
+ - Optimized for real-time quality control applications
82
+
83
+ ## Citation
84
+
85
+ If you use this model, please cite:
86
+
87
+ ```bibtex
88
+ @misc{grain_classifier_2025,
89
+ title={Grain Quality Classification Model},
90
+ author={Your Name},
91
+ year={2025},
92
+ howpublished={\url{https://huggingface.co/Hk4crprasad/grain-quality}}
93
+ }
94
+ ```
95
+
96
+ ## License
97
+
98
+ MIT License - See LICENSE file for details.