0
votes

# Create model in inference mode import tensorflow as tf from tensorflow import keras with tf.device(DEVICE): model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config)`

# load the last best model you trained # weights_path = model.find_last()[1] custom_WEIGHTS_PATH = '/home/unni/my_project_work/car-damage-detection-using-CNN-master/logs/scratch20190612T2046/mask_rcnn_scratch_0013.h5' # Load weights print("Loading weights ", custom_WEIGHTS_PATH) model.load_weights(custom_WEIGHTS_PATH, by_name=True)`

This is the error AttributeError: in user code:

/home/unni/my_project_work/car-damage-detection-using-CNN-master/mrcnn/model.py:391 call  *
    roi_level = log2_graph(tf.sqrt(h * w) / (224.0 / tf.sqrt(image_area)))
/home/unni/my_project_work/car-damage-detection-using-CNN-master/mrcnn/model.py:342 log2_graph  *
    return tf.log(x) / tf.log(2.0)

Please help

1
Hi Rakesh, maybe you could clean up the post a bit and explain a bit more where exactly the error appears? Does it already crash during loading the weights? - Johannes Ackermann

1 Answers

0
votes

You are using the current version of Tensorflow, the code above works in an older version. use these lines of code and you will be good to go:

!pip install tensorflow==1.15.3

!pip install --no-deps keras==2.2.4