Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

Random results in demo and custom dataset detection

Open LifelessX1 opened this issue 2 years ago • 5 comments

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.

LifelessX1 avatar May 07 '22 16:05 LifelessX1

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

alsombra avatar May 17 '22 18:05 alsombra

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)

natha1008 avatar May 24 '22 06:05 natha1008

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).

giovform avatar Jun 13 '22 12:06 giovform

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!

jiayang-zhang avatar Jun 29 '22 15:06 jiayang-zhang

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.

giovform avatar Jun 29 '22 19:06 giovform