我正在尝试使用Matterport的实现来训练迁移学习模型,但在尝试加载MaskRCNN模型时收到错误消息: 代码如下:
!git clone https://www.github.com/matterport/Mask_RCNN.git
from mrcnn.config import Config
from mrcnn import utils
import mrcnn.model as modellib
from mrcnn import visualize
from mrcnn.model import log
from mrcnn.utils import Dataset
class myMaskRCNNConfig(Config):
# give the configuration a recognizable name
NAME = "MaskRCNN_config"
# set the number of GPUs to use along with the number of images
# per GPU
GPU_COUNT = 1
IMAGES_PER_GPU = 1
# number of classes (we would normally add +1 for the background)
# kangaroo + BG
NUM_CLASSES = 1+1
# Number of training steps per epoch
STEPS_PER_EPOCH = 131
# Learning rate
LEARNING_RATE=0.006
# Skip detections with < 90% confidence
DETECTION_MIN_CONFIDENCE = 0.9
# setting Max ground truth instances
MAX_GT_INSTANCES=10
config = myMaskRCNNConfig()
config.display()
print("Loading Mask R-CNN model...")
model = modellib.MaskRCNN(mode="training", config=config, model_dir='./')
错误消息是:
Loading Mask R-CNN model...
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-83-1ed1ff260563> in <module>()
1 print("Loading Mask R-CNN model...")
----> 2 model = modellib.MaskRCNN(mode="training", config=config, model_dir='./')
10 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/type_spec.py in type_spec_from_value(value)
552
553 raise TypeError("Could not build a TypeSpec for %r with type %s" %
--> 554 (value, type(value).__name__))
555
556
TypeError: Could not build a TypeSpec for <KerasTensor: shape=(None, None, 4) dtype=float32 (created by layer 'tf.math.truediv_7')> with type KerasTensor
问题在哪里
目前没有回答
相关问题 更多 >
编程相关推荐