This repository contains a Python project for identifying food items in images using a pretrained model from Hugging Face. The model, nateraw/food
, leverages advanced machine learning techniques to classify various food items with high accuracy.
- Pretrained Model: Utilizes the
nateraw/food
model from Hugging Face for image classification. - Image Processing: Handles image preprocessing using the
transformers
andPIL
libraries. - Batch Processing: Supports processing multiple images from a directory.
- User-Friendly: Easy-to-understand code with clear instructions.
- Clone the repository:
git clone https://github.com/your-username/Food-Item-Identification-Using-Python.git
- Install the required packages:
pip install -r requirements.txt
- Run the script:
- Place your images in the
Images
directory. - Execute the script to identify food items in your images.
- Place your images in the
- Python 3.x
transformers
torch
Pillow
Here is an example of how to use the code:
from transformers import AutoModelForImageClassification, AutoImageProcessor
from PIL import Image
import torch
# Load the model
model_name = "nateraw/food"
model = AutoModelForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)