Mask RCNN更改输入通道数

tech2023-10-08  92

Mask RCNN更改输入通道数(以5通道为例) 1、在config.py中,修改:

IMAGE_CHANNEL_COUNT=5 MEAN_PIXEL = [.....] # 改为5通道的均值

2、utils.py中,修改load_image方法:

image= np.load(filename+'.npy') # 我选择直接采用npy方式保存图像数组,因此采用np.load

3、coco.py中,修改load_weight(二选一)

model.load_weights(COCO_MODEL_PATH, by_name=True, exclude=['conv1']) #80+1类的情况 model.load_weights(COCO_MODEL_PATH, by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask",'conv1']) # 2分类情况

4、model.py中添加:

layer_regex = { # all layers but the backbone "heads": r"(mrcnn\_.*)|(rpn\_.*)|(fpn\_.*)|(conv1.*)", # From a specific Resnet stage and up
最新回复(0)