Mask_RCNN
Mask_RCNN copied to clipboard
Random results in demo and custom dataset detection
I used the code from this fork and the results are so random even in the demo.ipynb file. What might be the issue and what can I do to fix it. Thank you.
I get the same issue, even though I am loading the Coco pre-trained weights. I don't know why but adding this piece of code solves it:
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)
Solution from Kamlesh364
I got the same problem... Using tensorflow (2.6, 2.7, 2.8, 2.9) but I solve it by changing the line for load_weights()... (recommended to be change for training and inference)...
--> model.load_weights(str(checkpoint (.h5)), by_name=True) tf.keras.Model.load_weights(model.keras_model, str(str(checkpoint (.h5)), by_name=True)
I got the same problem... Using tensorflow (2.6, 2.7, 2.8, 2.9) but I solve it by changing the line for load_weights()... (recommended to be change for training and inference)...
--> model.load_weights(str(checkpoint (.h5)), by_name=True) tf.keras.Model.load_weights(model.keras_model, str(str(checkpoint (.h5)), by_name=True)
Thanks @natha1008, solved the problem of using tensorflow > 2.5. 👍👍
Edit:
Also in training you will need to substitute:
exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"]
for:
skip_mismatch=True
since the exclude keyword is no more in tensorflow 2.8.2 (version I am testing).
I got the same problem... Using tensorflow (2.6, 2.7, 2.8, 2.9) but I solve it by changing the line for load_weights()... (recommended to be change for training and inference)... --> model.load_weights(str(checkpoint (.h5)), by_name=True) tf.keras.Model.load_weights(model.keras_model, str(str(checkpoint (.h5)), by_name=True)
Thanks @natha1008, solved the problem of using tensorflow > 2.5. 👍👍
Edit:
Also in training you will need to substitute:
exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"]
for:
skip_mismatch=True
since the exclude keyword is no more in tensorflow 2.8.2 (version I am testing).
Hi @giovform , I'm having the same problem using tensorflow 2.8.2. Where exactly did you make the changes? Under mcrnn/model.py or demo.ipynb? I'm struggling to find where and what changes I should make.
Thanks for your help in advance!
I got the same problem... Using tensorflow (2.6, 2.7, 2.8, 2.9) but I solve it by changing the line for load_weights()... (recommended to be change for training and inference)... --> model.load_weights(str(checkpoint (.h5)), by_name=True) tf.keras.Model.load_weights(model.keras_model, str(str(checkpoint (.h5)), by_name=True)
Thanks @natha1008, solved the problem of using tensorflow > 2.5. 👍👍 Edit: Also in training you will need to substitute:
exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"]
for:skip_mismatch=True
since the exclude keyword is no more in tensorflow 2.8.2 (version I am testing).Hi @giovform , I'm having the same problem using tensorflow 2.8.2. Where exactly did you make the changes? Under mcrnn/model.py or demo.ipynb? I'm struggling to find where and what changes I should make.
Thanks for your help in advance!
Hello @jiayang-zhang , the change is in the notebook that has a training example. You could see for example the train_shapes.ipynb, under shapes directory. Search for exclude=["mrcnn_class_logits"
on that notebook.