Views
No views yet
1import tensorflow as tf
2from tensorflow.keras.preprocessing import image
3import numpy as np
4
5# Load the model
6model = tf.keras.models.load_model('path_to_trashpred_model.h5')
7
8# Load and preprocess the image
9img = image.load_img('path_to_image.jpg', target_size=(224, 224))
10img_array = image.img_to_array(img)
11img_array = np.expand_dims(img_array, axis=0) / 255.0
12
13# Predict
14predictions = model.predict(img_array)
15predicted_class = np.argmax(predictions, axis=1)
16
17print(f"Predicted class: {predicted_class}")
18Repository Structure
19
20TRASHPRED/
21├── model/
22│ └── trashpred_model.h5
23├── datasets/
24│ ├── train/
25│ └── validation/
26├── scripts/
27│ ├── train.py
28│ └── evaluate.py
29├── README.md
30📄 License
31This project is licensed under the MIT License.
32
33Author
34Name: Sriram Rampelli
35
36For more projects and information, visit Sriram Rampelli's GitHub Profile.