categorical_crossentropy_example.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:keras-semantic-segmentation-example 作者: mrgloom 项目源码 文件源码
def get_model():

    inputs = Input((IMAGE_H, IMAGE_W, INPUT_CHANNELS))

    base = models.get_fcn_vgg16_32s(inputs, NUMBER_OF_CLASSES)
    #base = models.get_fcn_vgg16_16s(inputs, NUMBER_OF_CLASSES)
    #base = models.get_fcn_vgg16_8s(inputs, NUMBER_OF_CLASSES)
    #base = models.get_unet(inputs, NUMBER_OF_CLASSES)
    #base = models.get_segnet_vgg16(inputs, NUMBER_OF_CLASSES)

    # softmax
    reshape= Reshape((-1,NUMBER_OF_CLASSES))(base)
    act = Activation('softmax')(reshape)

    model = Model(inputs=inputs, outputs=act)
    model.compile(optimizer=Adadelta(), loss='categorical_crossentropy')

    #print(model.summary())
    #sys.exit()

    return model
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号