Zahaab commited on
Commit
cfcdda7
·
verified ·
1 Parent(s): c38614f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -3
README.md CHANGED
@@ -1,3 +1,55 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model:
4
+ - timm/tf_efficientnet_b0.in1k
5
+ pipeline_tag: image-classification
6
+ tags:
7
+ - pizza
8
+ - steak
9
+ - sushi
10
+ ---
11
+ # Food Classifier
12
+
13
+ This repository contains a pre-trained PyTorch model for classifying food based on images. The model file `food_model.pth` can be downloaded and used to classify images of pizza, steak or sushi.
14
+
15
+ ## Model Overview
16
+
17
+ The `food_model.pth` file is a PyTorch model trained on a dataset of food images. It achieves a test accuracy of **84.56%**, making it a reliable choice for identifying pizza, steak, and sushi. The model is designed to be lightweight and efficient for real-time applications.
18
+
19
+ ## Requirements
20
+
21
+ - **Python** 3.7 or higher
22
+ - **PyTorch** 1.8 or higher
23
+ - **torchvision** (for loading and preprocessing images)
24
+
25
+ ## Usage
26
+
27
+ 1. Clone this repository and install dependencies.
28
+ ```bash
29
+ git clone <repository-url>
30
+ cd <repository-folder>
31
+ pip install torch torchvision
32
+ ```
33
+ 2. Load and use the model in your Python script:
34
+ ```python
35
+ import torch
36
+ from torchvision import transforms
37
+ from PIL import Image
38
+
39
+ # Load the model
40
+ model = torch.load('aircraft_classifier.pth')
41
+ model.eval() # Set to evaluation mode
42
+
43
+ # Load and preprocess the image
44
+ transform = transforms.Compose([
45
+ transforms.Resize((224, 224)),
46
+ transforms.ToTensor(),
47
+ ])
48
+ img = Image.open('path_to_image.jpg')
49
+ img = transform(img).view(1, 3, 224, 224) # Reshape to (1, 3, 224, 224) for batch processing
50
+
51
+ # Predict
52
+ with torch.no_grad():
53
+ output = model(img)
54
+ _, predicted = torch.max(output, 1)
55
+ print("Predicted Food Type:", predicted.item())