Views
No views yet
Note: Dataset not included in repo; download link below. NWPU-RESISC45 Dataset: https://github.com/remote-sensing-datasets/NWPU-RESISC45
1from tensorflow.keras.models import load_model
2from tensorflow.keras.preprocessing import image
3import numpy as np
4
5model = load_model("model_weights.h5")
6img = image.load_img("example.jpg", target_size=(224,224))
7x = image.img_to_array(img)
8x = np.expand_dims(x, axis=0)/255.0
9pred = model.predict(x)
10pred_class = np.argmax(pred, axis=1)
11print(f"Predicted class: {pred_class}")