Instructions to use starpreeda/BrainTumorTest with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use starpreeda/BrainTumorTest with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://starpreeda/BrainTumorTest") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -54,3 +54,23 @@ Input (224, 224, 3)
|
|
| 54 |
↳ Dropout(0.4)
|
| 55 |
↳ Dense(4, activation='softmax')
|
| 56 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
↳ Dropout(0.4)
|
| 55 |
↳ Dense(4, activation='softmax')
|
| 56 |
---
|
| 57 |
+
🚀 How to Load and Use
|
| 58 |
+
|
| 59 |
+
import tensorflow as tf
|
| 60 |
+
from tensorflow.keras.applications import EfficientNetB0
|
| 61 |
+
from tensorflow.keras.layers import Dense, GlobalAveragePooling2D, Dropout, BatchNormalization
|
| 62 |
+
from tensorflow.keras.models import Model
|
| 63 |
+
|
| 64 |
+
# Reconstruct Model Architecture
|
| 65 |
+
base_model = EfficientNetB0(weights=None, include_top=False, input_shape=(224, 224, 3))
|
| 66 |
+
x = base_model.output
|
| 67 |
+
x = GlobalAveragePooling2D()(x)
|
| 68 |
+
x = BatchNormalization()(x)
|
| 69 |
+
x = Dense(256, activation='relu')(x)
|
| 70 |
+
x = Dropout(0.4)(x)
|
| 71 |
+
outputs = Dense(4, activation='softmax')(x)
|
| 72 |
+
|
| 73 |
+
model = Model(inputs=base_model.input, outputs=outputs)
|
| 74 |
+
|
| 75 |
+
# Load Weights
|
| 76 |
+
model.load_weights("efficientnetb0_finetuned_brain_mri.keras")
|