matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.43k stars 11.67k forks source link

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' #993

Open world4jason opened 5 years ago

world4jason commented 5 years ago
def segnet_graph(input_tensor, num_seg_class, train_bn=True):
    N2, N3, N4, N5 = input_tensor

    deconv = KL.Conv2DTranspose(256, (2, 2), strides=2,activation="relu",name="seg_deconv_a")(N2)
    deconv = KL.Conv2D(256, (3, 3), padding="SAME", activation='relu', name="seg_conv_a")(deconv)

    deconv = KL.Conv2DTranspose(256, (2, 2), strides=2,activation="relu", name="seg_deconv_b")(deconv)
    Out = KL.Conv2D(num_seg_class, (3, 3), padding="SAME", activation='relu', name="seg_conv_b")(deconv)

    s = K.int_shape(Out)

    Out = KL.Reshape( (-1, num_seg_class))(Out)
    Out = KL.Activation('softmax')(Out)
    Out = KL.Reshape((s[1],s[2],num_seg_class))(Out)
    return Out

seg_score_map = small_segnet_graph_two(
                mrcnn_feature_maps,
                config.NUM_SEG_CLASSES,
                train_bn=config.TRAIN_BN)

I just want to simply add a branch for segmentation but why i always got the error

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

when i dump the layer's shape with "K.int_shape". For example, N2, I always get something like [None, None,None,256]. I think this might be the reason? but if I substitute -1 in KL.Reshape with the real number 1048576 or 1024*1024, I still got same error message. how can I deal with this problem? this almost drive me crazy lol

mjagadesh commented 5 years ago

TypeError: int() argument must be a string or a number, not 'NoneType'