Update README.md
Browse files
README.md
CHANGED
@@ -26,3 +26,27 @@ advanced decay, and skeletonized (Megyesi et al., 2005).
|
|
26 |
|
27 |
## Usage
|
28 |
The stage of decay classification is bodypart specific, that is, for the head, torso, or limbs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
## Usage
|
28 |
The stage of decay classification is bodypart specific, that is, for the head, torso, or limbs.
|
29 |
+
Classes: fresh (1), early decay (2), advanced decay (3), and skeletonized (4) based on [Megyesi et al's](https://pubmed.ncbi.nlm.nih.gov/15932096/) scoring method.
|
30 |
+
|
31 |
+
|
32 |
+
```python
|
33 |
+
from tensorflow.keras.models import load_model
|
34 |
+
import numpy as np
|
35 |
+
from tensorflow.keras.preprocessing.image import img_to_array, load_img
|
36 |
+
|
37 |
+
# Load the entire model
|
38 |
+
model = load_model('path_to_your_model') # e.g. head/inceptionV3 to perform stage of decay classfication of head images
|
39 |
+
|
40 |
+
# Load and preprocess an image
|
41 |
+
img = load_img('path_to_image.jpg', target_size=(299, 299)) # adjust size as per model input
|
42 |
+
img = img_to_array(img) # convert to numpy array
|
43 |
+
img = np.expand_dims(img, axis=0) # add batch dimension
|
44 |
+
img = img / 255.0 # normalize pixel values if needed
|
45 |
+
|
46 |
+
# Make predictions
|
47 |
+
predictions = model.predict(img)
|
48 |
+
|
49 |
+
# Use argmax to get the class label
|
50 |
+
predicted_class = np.argmax(predictions, axis=1)
|
51 |
+
```
|
52 |
+
|