Download model.py from Motunbuild/Alzhemers_classification: direct link, hf CLI and curl.
- Browser
- Download file 772 Bytes
-
https://huggingface.co/Motunbuild/Alzhemers_classification/resolve/main/model.py
- Command line
-
hf download hf://Motunbuild/Alzhemers_classification/model.py
-
curl -L -o model.py https://huggingface.co/Motunbuild/Alzhemers_classification/resolve/main/model.py
772 Bytes
| base_model = ResNet50(weights='imagenet', include_top=False, input_shape=input_shape, pooling='avg') | |
| # Freeze all layers first | |
| base_model.trainable = False | |
| # Unfreeze top `unfreeze_top` layers for fine-tuning | |
| for layer in base_model.layers[-unfreeze_top:]: | |
| layer.trainable = True | |
| # Build classifier head | |
| inputs = Input(shape=input_shape) | |
| x = base_model(inputs, training=False) | |
| x = BatchNormalization()(x) | |
| x = Dense(512, activation='relu', kernel_regularizer=tf.keras.regularizers.l2(0.01))(x) | |
| x = Dropout(0.5)(x) | |
| x = BatchNormalization()(x) | |
| x = Dense(256, activation='relu', kernel_regularizer=tf.keras.regularizers.l2(0.01))(x) | |
| x = Dropout(0.4)(x) | |
| outputs = Dense(num_classes, activation='softmax')(x) | |