only resNet -50?
Try this.
@mekomlusa Can't link
@engineer1109 Try this. I remember @flyyufelix put his pre-trained ImageNet weights somewhere on Google Drive, but can't recall it right off my head.
Wait, I thought given init_with = "imagnet" # imagenet, coco, or last in the demo means, there are res50, res101 pre-trained weight for both coco and imagenet with this repo. No?
I think model just uses resnet50 weights for resnet101 model whereever possible and randomly initializes rest of the layers.
@talhasaruhan is right. At least I know that ImageNet weight is resnet50 only. See the snapshot below (find more in the source code).
def get_imagenet_weights(self):
"""Downloads ImageNet trained weights from Keras.
Returns path to weights file.
"""
from keras.utils.data_utils import get_file
TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\
'releases/download/v0.2/'\
'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5'
weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5',
TF_WEIGHTS_PATH_NO_TOP,
cache_subdir='models',
md5_hash='a268eb855778b3df3c7506639542a6af')
return weights_path
Hi everyone,
Have you tried to use ResNet-101 weights for fine tuning your network? Did you get better results than other solutions?
Thank you!
@Paulito-7 someone has: https://github.com/matterport/Mask_RCNN/issues/1#issuecomment-363047122
@Paulito-7 I tried that and results weren't much different, although it depends on your training schedule (do you train all the network from epoch 0 or do you train heads for a couple of decades then train the complete network) As always YMMV
@talhasaruhan How do you train the network? My AP is awful.
I train the model all from epoch 0 to 100, learning rate =0.001
Then train the model all from epoch 100 to 150, learning rate =0.0001
Then train the model all from epoch 150 to 200, learning rate =0.00001
@engineer1109 I tried training with constant 0.001 for about 200 epochs and starting from 0.002 w/ reduceLrOnPlateau with factor 0.5, at first both training and validation losses were quite above the model with default resnet50 weights. But it started to converge to the same line near the end.
@talhasaruhan weight_decay=0.002?
@engineer1109 nope, I had two different runs, one with lr constant 0.00,1 one with lr starting from 0.002 & ReduceLROnPlateau callback. (factor 0.5 patience 20)
@talhasaruhan Could you please explain a bit what gives you the idea and how this would work ?
I found an if-statement that checks for the backbone name when building the model:
That would imply that the model is created entirely with some kind of randomly initialized weights and later the pre-trained weights are loaded in:
But if this is correct, the first stage of the training would go bad l, since the last layers of resnet101 are not trained, their output would be noise fed into the RoI predictor that follow. Not that only the heads are re-trained in the first 40 epochs, not the imagenet backbone weights:
any idea on what is really happening with the BACKBONE=resnet101 but resnet50-imagenet weights are downloaded? @waleedka senpai?
Keras application have a resnet weights https://github.com/keras-team/keras-applications/releases/tag/resnet
@Mhaiyang @zhuchen115 I keep getting Value Error
ValueError Traceback (most recent call last)
<ipython-input-9-e5c3a80cd965> in <module>()
5 WEIGHTS_DIR = "resnet101_weights_tf.h5"
6 IMAGENET_DIR = os.path.join(ROOT_DIR, WEIGHTS_DIR)
----> 7 model.load_weights(IMAGENET_DIR)
8 elif init_with == "coco":
9 # Load weights trained on MS COCO, but skip layers that
1 frames
/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in load_weights_from_hdf5_group(f, layers, reshape)
1028 'containing ' + str(len(layer_names)) +
1029 ' layers into a model with ' +
-> 1030 str(len(filtered_layers)) + ' layers.')
1031
1032 # We batch weight value assignments in a single backend call
ValueError: You are trying to load a weight file containing 304 layers into a model with 233 layers.
and
ValueError Traceback (most recent call last)
<ipython-input-10-99a1663bd5c4> in <module>()
5 WEIGHTS_DIR = "resnet101_weights_tf_dim_ordering_tf_kernels_notop.h5"
6 IMAGENET_DIR = os.path.join(ROOT_DIR, WEIGHTS_DIR)
----> 7 model.load_weights(IMAGENET_DIR)
8 elif init_with == "coco":
9 # Load weights trained on MS COCO, but skip layers that
1 frames
/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in load_weights_from_hdf5_group(f, layers, reshape)
1028 'containing ' + str(len(layer_names)) +
1029 ' layers into a model with ' +
-> 1030 str(len(filtered_layers)) + ' layers.')
1031
1032 # We batch weight value assignments in a single backend call
ValueError: You are trying to load a weight file containing 208 layers into a model with 233 layers.
@nyck33
Try to use
model.load_weights(IMAGENET_DIR, by_name=True)