YuwenXiong / py-R-FCN

R-FCN with joint training and python support
MIT License
1.05k stars 471 forks source link

train the detection model on a subset of the coco classes #68

Closed e40614 closed 7 years ago

e40614 commented 7 years ago

Hi,

I'm trying to train model with only 2 class(person and background). I know that I should modify train.prototxt and test.prototxt. I trace "models/coco/ResNet-101/rfcn_end2end/train_agnostic.prototxt",and discover that the param cls_num of layer rfcn_bbox is 8 not 21.

layer {
  name: 'input-data'
  type: 'Python'
  top: 'data'
  top: 'im_info'
  top: 'gt_boxes'
  python_param {
    module: 'roi_data_layer.layer'
    layer: 'RoIDataLayer'
    param_str: "'num_classes': 21"  --->num_classes=21
  }
}
layer {
    bottom: "conv_new_1"
    top: "rfcn_cls"
    name: "rfcn_cls"
    type: "Convolution"
    convolution_param {
        num_output: 1029 #21*(7^2) cls_num*(score_maps_size^2) --->cls_num=21
        kernel_size: 1
        pad: 0
        weight_filler {
            type: "gaussian"
            std: 0.01
        }
        bias_filler {
            type: "constant"
            value: 0
        }
    }
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
}
layer {
    bottom: "conv_new_1"
    top: "rfcn_bbox"
    name: "rfcn_bbox"
    type: "Convolution"
    convolution_param {
        num_output: 392 #8*(7^2) cls_num*(score_maps_size^2) ---> cls_num=8

this part in "pascal_voc/ResNet-101/rfcn_end2end/class-aware/train_ohem.prototxt" is "num_output: 4116 #8(7^2) cls_num(score_maps_size^2)" In issue "cls_num in prototxt is not same", liyi14 says it is a typo in that case. Is it also a typo in this case? In "daijifeng001/R-FCN/models/rfcn_prototxts/ResNet-50L_res3a/train_val.prototxt", this part is also "num_output: 392 #8(7^2) cls_num(score_maps_size^2)".


        kernel_size: 1
        pad: 0
        weight_filler {
            type: "gaussian"
            std: 0.01
        }
        bias_filler {
            type: "constant"
            value: 0
        }
    }
    param {
        lr_mult: 1.0
    }
    param {
        lr_mult: 2.0
    }
}

Is there any other line I need to modify? Thanks for the help!

e40614 commented 7 years ago

Oops, I forgot to see the issues that was be closed. https://github.com/Orpine/py-R-FCN/issues/9 https://github.com/Orpine/py-R-FCN/issues/3 https://github.com/Orpine/py-R-FCN/issues/44 The question I asked has been solved.