# Available whenever available in the library Use pre-trained ResNet50 models
covn_base = tf.keras.applications.ResNet50(weights='imagenet', include_top = False,
input_shape=(im_height,im_width,3), layers=tf.keras.layers)
K.set_learning_phase(1)
"""
freeze the weights for the first 174-33=141
frezee the level 141 before
"""
for layer in covn_base.layers[0:141]:
layer.trainable = False
for layer in covn_base.layers[141:]:
layer.trainable = True
model.add(covn_base)
model.add(tf.keras.layers.GlobalAveragePooling2D())
model.add(tf.keras.layers.Dense(512,activation="relu"))
model.add(tf.keras.layers.Dropout(rate=0.2))
model.add(tf.keras.layers.Dense(CLASS,activation="softmax"))
Load pre training model with your own classification model!!!
Read More:
- [Solved] Model training Error: _pickle.PicklingError: Can’t pickle
- [Solved] YOLOv5 Model training error: TypeError: new(): invalid data type ‘str’
- How to Solve keras load_model() Error
- Mxnet.gluon Load Pre Training
- How to Solve Yolox Training C Disk Full Issue
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- `Model.XXX` is not supported when the `Model` instance was constructed with eager mode enabled
- The lenet model trained by Python failed to predict its own handwritten pictures
- [Solved] error indicates that your module has parameters that were not used in producing loss
- Keras import a custom metric model error: unknown metric function: Please ensure this object is passed to`custom_object‘
- [Solved] pytorch loss.backward() Error: RuntimeError: Function AddBackward0 returned an invalid gradient at index 1…
- AttributeError: can‘t set attribute [How to Solve]
- pytorch model.load_state_dict Error [How to Solve]
- [Solved] Python matplotlib Error: RuntimeError: In set_size: Could not set the fontsize…
- [Solved] PyTorch Load Model Error: Missing key(s) RuntimeError: Error(s) in loading state_dict for
- Pytorch ValueError: Expected more than 1 value per channel when training, got input size [1, 768
- [Solved] Training yolov5 Error: attributeerror: can get attribute sppf on Module
- [ONNXRuntimeError] : 10 : INVALID_Graph loading model error
- pytorch RuntimeError: Error(s) in loading state_ Dict for dataparall… Import model error solution
- [Solved] HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/saved_model